authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-04-24 19:47:05-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-04-24 16:50:44-07:00
logd8bdfd8192fb43ca8f6abd223396a4073e369499
tree90adac574468de53f44105b89d0f4e9b1793bd1f
parenta2fe81a63992aa8d0d9b56dfbb6ffe525fdc907a

std: fix windows resource leaks


2 files changed, 3 insertions(+), 0 deletions(-)

lib/std/fs.zig+1
...@@ -1236,6 +1236,7 @@ pub const Dir = struct {...@@ -1236,6 +1236,7 @@ pub const Dir = struct {
1236 .capable_io_mode = std.io.default_mode,1236 .capable_io_mode = std.io.default_mode,
1237 .intended_io_mode = flags.intended_io_mode,1237 .intended_io_mode = flags.intended_io_mode,
1238 };1238 };
1239 errdefer file.close();
1239 var io: w.IO_STATUS_BLOCK = undefined;1240 var io: w.IO_STATUS_BLOCK = undefined;
1240 const range_off: w.LARGE_INTEGER = 0;1241 const range_off: w.LARGE_INTEGER = 0;
1241 const range_len: w.LARGE_INTEGER = 1;1242 const range_len: w.LARGE_INTEGER = 1;
lib/std/os/test.zig+2
...@@ -1101,6 +1101,8 @@ test "isatty" {...@@ -1101,6 +1101,8 @@ test "isatty" {
1101 defer tmp.cleanup();1101 defer tmp.cleanup();
11021102
1103 var file = try tmp.dir.createFile("foo", .{});1103 var file = try tmp.dir.createFile("foo", .{});
1104 defer file.close();
1105
1104 try expectEqual(os.isatty(file.handle), false);1106 try expectEqual(os.isatty(file.handle), false);
1105}1107}
11061108