Several graf entry points acquire resources mid-function then reach a call()/bare-return __ that short-circuits past their own cleanup label, leaking already-mapped files, fds, weave mmaps, or an owned graf-open on the error path — violating the acquire-at-top / release-by-owner discipline (CLAUDE.md §5). The goal is to route every failure through the single cleanup path.
Cleanup label bypassed by early returns.
graf/MERGE.c:33-64 GRAFMerge — base maps, then ours/theirs call(graf_merge_read,…) fails → returns before the FILEUnMap cleanup; mapped file(s)+fds leak.graf/REBASE.c:1008-1025 GRAFRebaseBlobMerge — call(WEAVEInit,&w1/&nu) failure returns before WEAVEFree(&w0/&w1); already-mapped weave tlv leaks.graf/MAP.c:244-252 GRAFMap — mid-function wh128bAcquire NOROOM → return __ skips if (own_graf) GRAFClose() (:428).graf/LOG.c:966-1006 graf_head_ahead_behind — non-NOPATH GRAFSwitchBranch failure returns, skipping if (own_open) GRAFClose() (:1083).None. Reached on missing inputs / mmap / BASS pressure.
Re-verified 2026-07-07: MAP.c and LOG.c sites were fixed by MEM-040's render-helper split; MERGE.c and REBASE.c remain.
- graf/MERGE.c:33-35 GRAFMerge — three call(graf_merge_read,…) in a row; a failure of the 2nd/3rd bare-returns past the cleanup: label (:60-63), leaking the earlier map(s). Capture results and goto cleanup. - graf/REBASE.c:1031-1033 GRAFRebaseBlobMerge — call(WEAVEInit,&w1/&nu) failure returns before WEAVEFree(&w0/&w1) (:1044-1046); capture-result the three inits. -v graf/MAP.c GRAFMap — fixed by MEM-040 d857a9cc: post-open body funneled through grafmap_render so if (own_graf) GRAFClose() (:229-230) runs on every exit; the wh128bAcquire NOROOM (:249-250) now returns through it. -v graf/LOG.c graf_head_ahead_behind — fixed by MEM-040 d857a9cc: post-open body funneled through grafhead_render so if (own_open) GRAFClose() (:1135-1136) runs on every exit, incl. the GRAFSwitchBranch failure (:1179-1181). - Repro first: graf merge with a missing ours/theirs; fault-inject WEAVEInit; assert no map/handle leak.
None. Reached on missing inputs / mmap / BASS pressure.