This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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]

[patch] Fix memory leak on bfd_close(BFD_IN_MEMORY)


Hi,

I feel the patch
2004-10-24  Daniel Jacobowitz  <dan@debian.org>

	* opncls.c (bfd_close): Return TRUE for BFD_IN_MEMORY.

Index: opncls.c
===================================================================
RCS file: /cvs/src/src/bfd/opncls.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -p -r1.25 -r1.26
--- opncls.c	10 Oct 2004 13:58:05 -0000	1.25
+++ opncls.c	24 Oct 2004 18:45:38 -0000	1.26
@@ -598,7 +598,7 @@ bfd_close (bfd *abfd)
   if (!(abfd->flags & BFD_IN_MEMORY))
     ret = abfd->iovec->bclose (abfd);
   else
-    ret = 0;
+    ret = TRUE;
 
   /* If the file was open for writing and is now executable,
      make it so.  */

introduced a memory leak.  This codepath occurs only on ia64 on the second run:
	(gdb) run
	(gdb) run

Attached patch which IMO fixes the leak and it does not crash (although it was
not ElectricFence-d) on ia64.

Maybe not worth it (yes, the proper function set should be implemented etc.).


Regards,
Jan Kratochvil

Attachment: gdb-6.5.50.20060801-bfd_close-BFD_IN_MEMORY.patch
Description: Text document


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