fuzz-tests: Prevent memory leak in `fuzz-initial_channel`
What changed, and why it matters
This commit fixes a small memory leak inside a fuzz test, which is an automated testing helper program, not part of the live Lightning node software. It does not affect real users, wallets, or network operations.
No security action required; treat as normal test-quality improvement.
Security signals we found
Memory leak fix in fuzz test harness only
No production code, consensus, or network logic modified
No input validation, authentication, or cryptographic code changed
Evidence from the diff
The change adds clean_tmpctx() before an early return in tests/fuzz/fuzz-initial_channel.c when the fuzz harness receives empty input. This prevents a leak of the temporary context allocated earlier in the test’s run() function. The fix is confined to test/fuzzing infrastructure and has no production code path impact.
Changed components
tests/fuzz/fuzz-initial_channel.cInspect captured patch +3 / −1
diff --git a/tests/fuzz/fuzz-initial_channel.c b/tests/fuzz/fuzz-initial_channel.c
index 2fa04c26..c4143618 100644
--- a/tests/fuzz/fuzz-initial_channel.c
+++ b/tests/fuzz/fuzz-initial_channel.c
@@ -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,
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.