zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit dd2035735fa2160f85bf8fb8cd8b978d77fac292 (tree)
parent 865d4d2d8c066fd72b1e81cfc81c927aeccde8db
Author: kcbanner <kcbanner@gmail.com>
Date:   Sat, 27 May 2023 17:33:13 -0400

debug: fix memory leak when an error occurs opening a pdb file

Diffstat:
Mlib/std/debug.zig | 1+
1 file changed, 1 insertion(+), 0 deletions(-)

diff --git a/lib/std/debug.zig b/lib/std/debug.zig @@ -881,6 +881,7 @@ fn readCoffDebugInfo(allocator: mem.Allocator, coff_bytes: []const u8) !ModuleDe // Only used by pdb path di.coff_section_headers = try coff_obj.getSectionHeadersAlloc(allocator); + errdefer allocator.free(di.coff_section_headers); var path_buf: [windows.MAX_PATH]u8 = undefined; const len = try coff_obj.getPdbPath(path_buf[0..]);