From: John Baldwin Date: Mon, 25 Feb 2019 22:25:01 +0000 (-0800) Subject: Fix BFD leak in dwarf2_get_dwz_file. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0f58c9e88ebee636206b946b00ea52b47056b320;p=binutils-gdb.git Fix BFD leak in dwarf2_get_dwz_file. Previously if build_id_verify failed, dwz_bfd was cleared to NULL via release(), but the BFD object was not destroyed. Use reset() with nullptr instead to delete the BFD. gdb/ChangeLog: * dwarf2read.c (dwarf2_get_dwz_file): Reset dwz_bfd to nullptr instead of releasing ownership. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c2340e694c2..879ad6a9707 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2019-02-25 John Baldwin + + * dwarf2read.c (dwarf2_get_dwz_file): Reset dwz_bfd to nullptr + instead of releasing ownership. + 2019-02-25 Jordan Rupprecht * dwarf2read.c (open_and_init_dwp_file): Call diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 2908a233fe4..2d6cb353fbb 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -2722,7 +2722,7 @@ dwarf2_get_dwz_file (struct dwarf2_per_objfile *dwarf2_per_objfile) if (dwz_bfd != NULL) { if (!build_id_verify (dwz_bfd.get (), buildid_len, buildid)) - dwz_bfd.release (); + dwz_bfd.reset (nullptr); } if (dwz_bfd == NULL)