diff options
Diffstat (limited to 'core/dump.zig')
| -rw-r--r-- | core/dump.zig | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/dump.zig b/core/dump.zig index 29aebce8..deb18dba 100644 --- a/core/dump.zig +++ b/core/dump.zig @@ -395,8 +395,9 @@ fn loadKnowing(gpa: std.mem.Allocator, opts: Options, bytes: []const u8, notes: }; defer l.deinit(); // A load that fails leaves nothing: what it read is freed, and the - // core with it, its fields never torn down one by one. + // core with it, its fields never torn down one by one; why, in `notes`. errdefer { + if (notes) |n| n.appendSlice(gpa, l.notes.items) catch {}; l.rollback(); p.fs.deinit(gpa); gpa.destroy(p); @@ -471,8 +472,9 @@ fn loadImage(gpa: std.mem.Allocator, opts: Options, bytes: []const u8, notes: ?* defer l.deinit(); l.blobs = r.blobs() catch null; // A load that fails leaves nothing: what it read is freed, and the - // core with it, its fields never torn down one by one. + // core with it, its fields never torn down one by one; why, in `notes`. errdefer { + if (notes) |n| n.appendSlice(gpa, l.notes.items) catch {}; l.rollback(); p.fs.deinit(gpa); gpa.destroy(p); |
