Skip to content

Fix use-after-free in setupOrigin and fetchOrigin#77

Merged
Boomatang merged 1 commit into
mainfrom
bug_fetch
Jun 4, 2026
Merged

Fix use-after-free in setupOrigin and fetchOrigin#77
Boomatang merged 1 commit into
mainfrom
bug_fetch

Conversation

@Boomatang

Copy link
Copy Markdown
Owner

Summary

Fixes a bug where the working path allocated by realPathFileAlloc was immediately freed instead of being deferred, causing the path memory to be deallocated before it was used in the subsequent git command. This resulted in origins not being configured correctly.

The fix changes allocator.free(_path) to defer allocator.free(_path) in both setupOrigin and fetchOrigin, ensuring the path remains valid for the lifetime of the function and is properly cleaned up on exit.

This bug was introduced during the Zig 0.16.0 upgrade.

During the zig 0.16.0 upgrade a `allocator.free` was not defered. This
caused the origins not to be configured correctlly.

Signed-off-by: Jim Fitzpatrick <jimfity@gmail.com>
@Boomatang Boomatang merged commit 42f700a into main Jun 4, 2026
2 checks passed
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