Skip to content

Commit 5e3cadf

Browse files
committed
debug: fixup memory management
1 parent 461fb49 commit 5e3cadf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/std/debug.zig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ pub fn openSelfDebugInfo(allocator: mem.Allocator) OpenSelfDebugInfoError!DebugI
838838
fn readCoffDebugInfo(allocator: mem.Allocator, coff_bytes: []const u8) !ModuleDebugInfo {
839839
nosuspend {
840840
const coff_obj = try allocator.create(coff.Coff);
841-
errdefer allocator.destroy(coff_obj);
841+
defer allocator.destroy(coff_obj);
842842
coff_obj.* = try coff.Coff.init(coff_bytes);
843843

844844
var di = ModuleDebugInfo{
@@ -1289,6 +1289,7 @@ pub const DebugInfo = struct {
12891289
self.allocator.destroy(mdi);
12901290
}
12911291
self.address_map.deinit();
1292+
if (native_os == .windows) self.modules.deinit(self.allocator);
12921293
}
12931294

12941295
pub fn getModuleForAddress(self: *DebugInfo, address: usize) !*ModuleDebugInfo {

0 commit comments

Comments
 (0)