--- id: "bug-1723" status: "fixed" status_updated: "2026-09-24" status_note: "" component: "lib" severity: "crash" timestamp: "2026-08-27T00:00:00Z" last_seen: "2026-09-19T09:00:00Z" occurrences: 1 files: ["src/lib/testsuite/test_xcealloc.c"] tags: ["memory-leak", "asan", "leaksanitizer", "xcealloc", "test-fixture-teardown", "scheduler-snapshot-job-allocation", "pre-existing", "out-of-scope"] related: ["bug-1722", "bug-1621", "bug-1437"] legacy: true --- # bug-1723: LeakSanitizer (xcelib_test's ASAN default detect_leaks=1, per bug-1437's established precedent… ## Description LeakSanitizer (xcelib_test's ASAN default detect_leaks=1, per bug-1437's established precedent that this is a separate pass/fail axis from Unity PASS/FAIL) aborts the whole xcelib_test binary at exit with SIGABRT even on a completely clean run (all Unity tests, including the new scheduler-snapshot-job-allocation task 1.1 dup_job_alloc() suite, report 0 Failures) -- 456 byte(s) leaked in 29 allocation(s), confirmed present identically at HEAD before task 1.1's changes (baseline A/B comparison: stashed task 1.1's 3 changed files, rebuilt, reran standalone binary -- same 456 bytes/29 allocations, same two leak sources, same SIGABRT). ## Environment _Not recorded (migrated from buglog.json)._ ## Reproduction _Not recorded (migrated from buglog.json)._ ## Root cause test_make_job_account_multi_host_no_overflow() (added in bug-1722's fix) calls free_job_account(account) but never frees its own directly-built fixture tree (jalloc/hallocs/h0/h1/a0/a1 -- make_job_alloc()'s calloc at xcealloc.c:156 and the two make_alloc()-internal strdup()s it roots). test_make_host_allocs_multi_host_no_overflow() (same commit) frees nothing at all (make_host_allocs()'s calloc at xcealloc.c:134 and its two hosts/allocs). Neither test calls free_JobAlloc_ptr() or any other teardown on its own locally-constructed xce_job_alloc_t/xce_host_alloc_t** tree. Pre-existing since bug-1722's commit (00207503), not introduced by task 1.1 -- confirmed via git-stash A/B rebuild showing byte-for-byte identical leak signature with task 1.1's 3 files reverted. ## Fix FIXED (2026-09-08, follow-up session). Applied exactly the fix this entry already specified: added free_JobAlloc_ptr(&jalloc); at the end of test_make_job_account_multi_host_no_overflow() (frees jalloc/hallocs/h0/h1/a0/a1's whole tree, after free_job_account(account) already frees the account side) and free_HostAlloc_list(2, hallocs); at the end of test_make_host_allocs_multi_host_no_overflow() (which previously freed nothing at all). This reduced the leak from 456 bytes/29 allocations to 12 bytes/2 allocations -- the residual was a DIFFERENT, deeper pre-existing production bug (free_host_account() never freeing acct->host), already independently logged as bug-1621 and fixed in the same pass; see that entry. Verified: standalone xcelib_test binary now 1/1 Ok with zero LeakSanitizer reports (was: SIGABRT on every run, even with all Unity tests passing); full xce-build.sh all asan --incremental: 94/94 Ok (controller/scheduler/lib/worker/apiserver C suites + all Go test packages), zero regressions. ## Verification _Not recorded (migrated from buglog.json)._ ## References - Related: bug-1722, bug-1621, bug-1437