Skip to content

Commit dd92643

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 edcf038 commit dd92643

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

plugins/spender/splice.c

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

187191
static struct command_result *calc_in_ppm_and_fee(struct command *cmd,
@@ -783,6 +787,8 @@ static struct command_result *splice_signed_error_pkg(struct command *cmd,
783787
error->end - error->start);
784788
abort_pkg->code = -1;
785789

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

0 commit comments

Comments
 (0)