Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Commit

Permalink
fix use after free (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattnite authored Apr 5, 2021
1 parent d92f2a5 commit e459954
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/commands.zig
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,10 @@ pub fn add(

var ret: []const u8 = default_root;
if (subproject.packages.count() == 1)
ret = subproject.packages.iterator().next().?.value.root orelse default_root;
ret = if (subproject.packages.iterator().next().?.value.root) |r|
try arena.allocator.dupe(u8, r)
else
default_root;

// TODO try other matching methods

Expand Down

0 comments on commit e459954

Please sign in to comment.