mirror of
https://github.com/ziglang/zig.git
synced 2026-10-14 10:27:43 -04:00
Dir.makeOpenPathAccessMaskW: Fix leaking intermediate directory handles
Fixes a regression introduced in67455c5e70. The `errdefer` cannot run since its not possible for an error to occur, and we don't want it to run on the last handle, so we move the closing back down to where it was before67455c5e70.
This commit is contained in:
1 parent
332fbb4b02
commit
5490021ab7
1 file changed
+5
-2
+5
-2
@@ -1217,10 +1217,13 @@ fn makeOpenPathAccessMaskW(self: Dir, sub_path: []const u8, access_mask: u32, no
|
||||
},
|
||||
else => |e| return e,
|
||||
};
|
||||
// Don't leak the intermediate file handles
|
||||
errdefer if (result) |*dir| dir.close();
|
||||
|
||||
component = it.next() orelse return result.?;
|
||||
|
||||
// Don't leak the intermediate file handles
|
||||
if (result) |*dir| {
|
||||
dir.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user