Skip to content

Commit b0505d1

Browse files
committed
splice-script: Memleak fix on failure
In some splice script failure modes, some memory is leaked. These don’t occur in normal operation — just when an error occurs. This cleans up those memory leaks.
1 parent e9f617c commit b0505d1

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

plugins/spender/splice.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,11 @@ static struct command_result *splice_error_pkg(struct command *cmd,
182182
const jsmntok_t *error,
183183
struct splice_index_pkg *pkg)
184184
{
185-
return splice_error(cmd, methodname, buf, error, pkg->splice_cmd);
185+
struct command_result *res = splice_error(cmd, methodname, buf, error, pkg->splice_cmd);
186+
187+
tal_free(pkg);
188+
189+
return res;
186190
}
187191

188192
static struct command_result *calc_in_ppm_and_fee(struct command *cmd,
@@ -784,6 +788,8 @@ static struct command_result *splice_signed_error_pkg(struct command *cmd,
784788
error->end - error->start);
785789
abort_pkg->code = -1;
786790

791+
tal_free(pkg);
792+
787793
return make_error(cmd, abort_pkg, "splice_signed_error");
788794
}
789795

0 commit comments

Comments
 (0)