PR25362, memory leak in nm

Message ID 20200113120856.GQ4433@bubble.grove.modra.org
State New
Headers show
Series
  • PR25362, memory leak in nm
Related show

Commit Message

Alan Modra Jan. 13, 2020, 12:08 p.m.
PR 25362
	* nm.c (display_rel_file): Free dyn_syms.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/binutils/nm.c b/binutils/nm.c
index 99d2027250..0ee3f88386 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -1171,6 +1171,8 @@  display_rel_file (bfd *abfd, bfd *archive_bfd)
 	  *symp = 0;
 	  symcount += synth_count;
 	}
+      if (!dynamic && dyn_syms != NULL)
+	free (dyn_syms);
     }
 
   /* lto_slim_object is set to false when a bfd is loaded with a compiler