Skip to content

Commit 0980d10

Browse files
Chandra Prataprustyrussell
authored andcommitted
fuzz-tests: Prevent memory leak in fuzz-initial_channel
Changelog-None: The current test can leak memory due to improper cleanup in the case of an early return. Fix it.
1 parent 616fde5 commit 0980d10

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/fuzz/fuzz-initial_channel.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ void run(const uint8_t *data, size_t size)
7373

7474
/* TODO: determine if it makes sense to check at each step for libfuzzer
7575
* to deduce pertinent inputs */
76-
if (!data || !size)
76+
if (!data || !size) {
77+
clean_tmpctx();
7778
return;
79+
}
7880

7981
for (enum side opener = 0; opener < NUM_SIDES; opener++) {
8082
channel = new_initial_channel(tmpctx, &cid, &funding,

0 commit comments

Comments
 (0)