Extends sim_reconcile_unaccounted_jobs()'s FOUND branch: takes ownership of a matched recorded DISPATCH decision's allocation (job->allocs = entry's alloc, not a copy -- mirrors scheduler.c's sched_commit_decision() precedent exactly), builds job->accounts via make_job_account(), then safely consumes the recorded entry -- nulling the source alloc pointer BEFORE freeing the entry (preventing a double-free through job->allocs), then compacting decoded_session->decisions via shift-down (memmove, never swap-with-last, which would reorder the remaining entries and break the positional --sim-verify comparison a later task depends on). Fixed a real correctness bug found while implementing: the "not found" check (i == n_decisions) goes stale once n_decisions can be decremented mid-loop by compaction -- replaced with an explicit found flag. Primary correctness bar: reconcile-then-release-through-normal-job-cleanup is ASAN-clean. Verified with ASAN_OPTIONS=detect_leaks=1 (beyond this suite's registered detect_leaks=0): zero double-free/UAF/overflow. Found and logged (not fixed, out of boundary) a real pre-existing leak in src/lib/misc.c's free_host_account() -- equally present on the live dispatch path, bug-1621. 46/47 scheduler tests pass; the 1 failure is pre-existing bug-1560 (unrelated). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| settings | ||
| specs | ||
| steering | ||