Skip to content

Commit c10eec5

Browse files
committed
std: fix some memory leaks in traceback code
1 parent 2c9f6da commit c10eec5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

std/debug.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,6 +1509,7 @@ const LineNumberProgram = struct {
15091509

15101510
fn readStringRaw(allocator: *mem.Allocator, in_stream: var) ![]u8 {
15111511
var buf = ArrayList(u8).init(allocator);
1512+
errdefer buf.deinit();
15121513
while (true) {
15131514
const byte = try in_stream.readByte();
15141515
if (byte == 0) break;
@@ -1639,6 +1640,7 @@ fn parseDie(di: *DwarfInfo, abbrev_table_offset: usize, is_64: bool) !?Die {
16391640
const tag_id = try leb.readULEB128(u64, di.dwarf_in_stream);
16401641
const has_children = (try di.dwarf_in_stream.readByte()) == DW.CHILDREN_yes;
16411642
var attrs = ArrayList(Die.Attr).init(di.allocator);
1643+
errdefer attrs.deinit();
16421644

16431645
while (true) {
16441646
const attr_id = try leb.readULEB128(u64, di.dwarf_in_stream);

0 commit comments

Comments
 (0)