Skip to content

fix(s3): avoid double-freeing path when presign throws after store creation - #30495

Closed
robobun wants to merge 4 commits into
mainfrom
farm/cf450992/fix-s3-path-double-free
Closed

fix(s3): avoid double-freeing path when presign throws after store creation#30495
robobun wants to merge 4 commits into
mainfrom
farm/cf450992/fix-s3-path-double-free

also leave path ownership with caller when constructor throws after i…

1136af3
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed May 11, 2026 in 21m 32s

Code review found 2 potential issues

Found 3 candidates, confirmed 2. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/runtime/webcore/S3File.zig:271-274 Constructor errdefer overwrite can leak pathlike (toThreadSafe clone, and errdefer-less callers)

Annotations

Check warning on line 274 in src/runtime/webcore/S3File.zig

See this annotation in the file changed.

@claude claude / Claude Code Review

Constructor errdefer overwrite can leak pathlike (toThreadSafe clone, and errdefer-less callers)

The new `errdefer { store.data.s3.pathlike = empty; store.deinit(); }` assumes the store's pathlike still aliases the caller's `path` and that the caller has an `errdefer path.deinit()` — neither always holds. `initS3` calls `toThreadSafe()` on a *local copy*, so for `.slice_with_underlying_string` the store may hold a freshly-cloned impl that is now overwritten without being dereffed; and `S3Client.staticFile` / `S3File.constructInternal` have no `errdefer path.deinit()`, so for them the path i