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.
This commit is contained in:
Chandra Pratap
2025-06-18 06:20:32 +00:00
committed by Rusty Russell
parent 616fde5254
commit 0980d10442

View File

@@ -73,8 +73,10 @@ void run(const uint8_t *data, size_t size)
/* TODO: determine if it makes sense to check at each step for libfuzzer
* to deduce pertinent inputs */
if (!data || !size)
if (!data || !size) {
clean_tmpctx();
return;
}
for (enum side opener = 0; opener < NUM_SIDES; opener++) {
channel = new_initial_channel(tmpctx, &cid, &funding,