AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 27 Bitcoin

common: tal_wally_discard()

Public commit record

What the developer wrote

Authored by Rusty Russell

48/100 · Thin
common: tal_wally_discard()

In several places we were using tal_wally_end(tmpctx), which assumes
that libwally isn't using any of those allocations.

Make an explicit "tal_wally_discard" which asserts that there are no
outstanding libwally allocations.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
✓ Descriptive subject✓ Provides detailed explanatory context! Too few words to establish purpose
The short version

What changed, and why it matters

This commit adds a new helper function, tal_wally_discard(), to safely clean up temporary memory used by the libwally library. Previously, code used a different cleanup function that assumed libwally had not made any long-lived allocations. The new function explicitly checks that assumption and will crash the program if it is wrong, turning a potential silent memory bug into an obvious failure. It is a defensive hardening change, not a fix for an actively exploitable vulnerability.

Recommended action

Review existing tal_wally_end(tmpctx) call sites and convert appropriate ones to tal_wally_discard() to enforce the temporary-allocation invariant. Monitor CI and runtime for assertion failures after deployment.

Security signals we found

01

Defensive assertion added to detect unexpected libwally allocation state

02

Prevents potential use-after-free or double-free from incorrect tal_wally_end(tmpctx) usage

03

Memory-management hardening in Bitcoin/Lightning cryptographic helper layer

Risk score

Why this scored 27/100

Our methodology →
Potential impact 5/30
Exploitability 3/25
Stealth signal 4/15
Affected reach 6/15
Confidence 6/10
Evidence quality 3/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.