Skip to content

Fix leak on allocation failure in ArrayBuffer#transfer#516

Closed
bptato wants to merge 1 commit into
bellard:masterfrom
bptato:transfer-oom
Closed

Fix leak on allocation failure in ArrayBuffer#transfer#516
bptato wants to merge 1 commit into
bellard:masterfrom
bptato:transfer-oom

Conversation

@bptato

@bptato bptato commented May 27, 2026

Copy link
Copy Markdown
Contributor

Move construction /before/ the buffer is detached, so that an allocation failure doesn't detach the backing buffer. (My previous attempt just cleaned up the buffer in this case; this patch preserves it so it can still be used after catching the InternalError.)

This time I've left JS_NewArrayBuffer unchanged, and instead documented its existing ownership semantics. (I'm not sure if this is better, but at least there is no breaking change.)

@bptato bptato marked this pull request as draft May 27, 2026 15:35
Move construction /before/ the buffer is detached, so that an allocation
failure doesn't detach the backing buffer.

This time I've left JS_NewArrayBuffer unchanged, and instead documented its
existing ownership semantics.  (I'm not sure if this is better, but at
least there is no breaking change.)
@bptato bptato marked this pull request as ready for review May 27, 2026 15:56
@bellard

bellard commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Fixed

@bellard bellard closed this Jun 2, 2026
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.

2 participants