Commit 2b35615ffb

Ben Noordhuis <info@bnoordhuis.nl>
2018-02-19 23:06:54
fix memory leak in std.debug.openSelfDebugInfo()
1 parent ab48934
Changed files (1)
std
debug
std/debug/index.zig
@@ -239,6 +239,7 @@ pub fn openSelfDebugInfo(allocator: &mem.Allocator) !&ElfStackTrace {
     switch (builtin.object_format) {
         builtin.ObjectFormat.elf => {
             const st = try allocator.create(ElfStackTrace);
+            errdefer allocator.destroy(st);
             *st = ElfStackTrace {
                 .self_exe_file = undefined,
                 .elf = undefined,