Skip to content

dos.library: new_lock frees the FileLock block if fs_port_addr fails - #200

Merged
sidick merged 1 commit into
mainfrom
codewiz/new-lock-leak-fix
Oct 23, 2026
Merged

sidick merged 1 commit into
mainfrom
codewiz/new-lock-leak-fix

Conversation

@sidick

@sidick sidick commented Oct 23, 2026

Copy link
Copy Markdown
Owner

Found by code review of #197/#198's dvp_Port/fl_Task plumbing: new_lock allocates a FileLock with alloc_lock_struct, then calls fs_port_addr to get the synthetic filesystem port for fl_Task. If fs_port_addr fails (e.g. the guest heap is too exhausted to also allocate the MsgPort, on the very first lock of a run), the ? propagated the error without freeing the already-allocated FileLock block or inserting it into self.locks -- orphaning that memory from the heap's free list for the rest of the run.

Fixes it by freeing the block on that error path before returning.

Test plan

  • cargo test -p volamos-core doslock: 85 pass

🤖 Generated with Claude Code

alloc_lock_struct() can succeed and then fs_port_addr() fail (e.g. a
near-exhausted guest heap on the first lock ever created), propagating
the error without freeing the just-allocated block or registering it
in self.locks -- orphaning it from the heap's free list for the rest
of the run.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@sidick
sidick merged commit 82f3242 into main Oct 23, 2026
9 checks passed
@sidick
sidick deleted the codewiz/new-lock-leak-fix branch October 23, 2026 15:18
@sidick sidick mentioned this pull request Oct 23, 2026
4 tasks done
sidick added a commit that referenced this pull request Oct 23, 2026
Fills in the 0.13 changelog: ixemul.library's full path-based file
I/O (GetDeviceProc's dvp_Port, the path packet actions, and Info())
from #197/#198, Supervisor()'s real exception frame unblocking nested
library calls from #199, the dl_TimeReq clock() fix from #194, the
remaining AllocDosObject types (DOS_STDPKT/DOS_CLI) from #187, and
#200's new_lock leak fix. Also documents these in
Supported-Libraries.md (expanded packet-action list, Supervisor's
RTE-anywhere support, dl_TimeReq).

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant