]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix BFD leak in dwarf2_get_dwz_file.
authorJohn Baldwin <jhb@FreeBSD.org>
Mon, 25 Feb 2019 22:25:01 +0000 (14:25 -0800)
committerJohn Baldwin <jhb@FreeBSD.org>
Mon, 25 Feb 2019 22:25:01 +0000 (14:25 -0800)
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.

gdb/ChangeLog
gdb/dwarf2read.c

index c2340e694c2f4a9b57b36e32840fe0ec6da83e6e..879ad6a97079d7560ae7ccfb0c5044d6cda3f88e 100644 (file)
@@ -1,3 +1,8 @@
+2019-02-25  John Baldwin  <jhb@FreeBSD.org>
+
+       * dwarf2read.c (dwarf2_get_dwz_file): Reset dwz_bfd to nullptr
+       instead of releasing ownership.
+
 2019-02-25  Jordan Rupprecht  <rupprecht@google.com>
 
        * dwarf2read.c (open_and_init_dwp_file): Call
index 2908a233fe49626ea96c69bd3cc5f405a4e3252a..2d6cb353fbbd7cc7311a00ffb24b37eda35613b8 100644 (file)
@@ -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)