This is the mail archive of the
mailing list for the binutils project.
PR22191, memory leak in dwarf2.c
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Sun, 24 Sep 2017 21:04:46 +0930
- Subject: PR22191, memory leak in dwarf2.c
- Authentication-results: sourceware.org; auth=none
table->sequences is a linked list before it is replaced by a bfd_alloc
array in sort_line_sequences.
* dwarf2.c (decode_line_info): Properly free line sequences on error.
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index ec4c311..1566cd8 100644
@@ -2476,8 +2476,12 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
- if (table->sequences != NULL)
- free (table->sequences);
+ while (table->sequences != NULL)
+ struct line_sequence* seq = table->sequences;
+ table->sequences = table->sequences->prev_sequence;
+ free (seq);
if (table->files != NULL)
if (table->dirs != NULL)
Australia Development Lab, IBM