This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb/binutils-2_29-branch] Import patch from mainline to fix memory leak.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5709459090fb152a85141d34e6817bc597c6997a

commit 5709459090fb152a85141d34e6817bc597c6997a
Author: Nick Clifton <nickc@redhat.com>
Date:   Tue Sep 5 14:53:37 2017 +0100

    Import patch from mainline to fix memory leak.
    
    	PR binutils/22032
    	* opncls.c (bfd_close_all_done): Don't call bfd_cache_close
    	before _close_and_cleanup.  Call iovec->bclose after.
    	(bfd_close): Remove code common to, and call, bfd_close_all_done.

Diff:
---
 bfd/ChangeLog |  9 +++++++++
 bfd/opncls.c  | 19 +++++--------------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index db9d0a9..fc93dec 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,12 @@
+2017-09-05  Nick Clifton  <nickc@redhat.com>
+
+	Import from mainline:
+
+	PR binutils/22032
+	* opncls.c (bfd_close_all_done): Don't call bfd_cache_close
+	before _close_and_cleanup.  Call iovec->bclose after.
+	(bfd_close): Remove code common to, and call, bfd_close_all_done.
+
 2017-09-04  Nick Clifton  <nickc@redhat.com>
 
 	Import from mainline:
diff --git a/bfd/opncls.c b/bfd/opncls.c
index 913341c..fa54986 100644
--- a/bfd/opncls.c
+++ b/bfd/opncls.c
@@ -726,25 +726,13 @@ RETURNS
 bfd_boolean
 bfd_close (bfd *abfd)
 {
-  bfd_boolean ret;
-
   if (bfd_write_p (abfd))
     {
       if (! BFD_SEND_FMT (abfd, _bfd_write_contents, (abfd)))
 	return FALSE;
     }
 
-  if (! BFD_SEND (abfd, _close_and_cleanup, (abfd)))
-    return FALSE;
-
-  ret = abfd->iovec->bclose (abfd) == 0;
-
-  if (ret)
-    _maybe_make_executable (abfd);
-
-  _bfd_delete_bfd (abfd);
-
-  return ret;
+  return bfd_close_all_done (abfd);
 }
 
 /*
@@ -774,7 +762,10 @@ bfd_close_all_done (bfd *abfd)
 {
   bfd_boolean ret;
 
-  ret = bfd_cache_close (abfd);
+  if (! BFD_SEND (abfd, _close_and_cleanup, (abfd)))
+    return FALSE;
+
+  ret = abfd->iovec->bclose (abfd) == 0;
 
   if (ret)
     _maybe_make_executable (abfd);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]