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] Undo the recent memory leak fix due to its regression


Hi,

here is undo of the recent change:

2007-08-08  Michael Snyder  <msnyder@access-company.com>

	* solib-svr4.c (open_symbol_file_object): Memory leak.
	(svr4_current_sos): Ditto.
	(enable_break): Ditto.

(solib-svr4.c 1.71 -> 1.72)

as it is causing many regressions, visible at least by `gdb.base/call-sc.exp':
	(gdb) run
	Starting program: /home/jkratoch/redhat/sources/gdb/testsuite/gdb.base/call-sc-tc
	BFD: reopening <NON-ASCII GARBAGE>: No such file or directory
	(general FAIL)

Tried to fix it at the right place
	http://sourceware.org/ml/binutils/2007-08/msg00153.html

but the problem needs more decisions if the whole BFD memory management should
be changed or not one of the required fixed would be:

--- gdb/exec.c	31 Jul 2007 21:49:21 -0000	1.67
+++ gdb/exec.c	10 Aug 2007 12:50:38 -0000
@@ -129,12 +129,9 @@ exec_close (int quitting)
 
   if (exec_bfd)
     {
-      char *name = bfd_get_filename (exec_bfd);
-
       if (!bfd_close (exec_bfd))
 	warning (_("cannot close \"%s\": %s"),
-		 name, bfd_errmsg (bfd_get_error ()));
-      xfree (name);
+		 bfd_get_filename (exec_bfd), bfd_errmsg (bfd_get_error ()));
       exec_bfd = NULL;
     }
 
but the right way would be also to strdup() bfd_get_filename() etc.


So rather proposing to temporarily undo the fix.


Regards,
Jan
2007-08-10  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* solib-svr4.c (enable_break): Undo the recent broken memory leak fix.

--- gdb/solib-svr4.c	8 Aug 2007 18:08:52 -0000	1.72
+++ gdb/solib-svr4.c	10 Aug 2007 12:57:49 -0000
@@ -1003,12 +1003,12 @@ enable_break (void)
       /* TODO drow/2006-09-12: This is somewhat fragile, because it
 	 relies on read_pc.  On both Solaris and GNU/Linux we can use
 	 the AT_BASE auxilliary entry, which GDB now knows how to
-	 access, to find the base address.  */
+	 access, to find the base address.
+	 TMP_PATHNAME memory gets embedded into TMP_BFD!  */
 
       tmp_fd = solib_open (buf, &tmp_pathname);
       if (tmp_fd >= 0)
 	tmp_bfd = bfd_fopen (tmp_pathname, gnutarget, FOPEN_RB, tmp_fd);
-      xfree (tmp_pathname);
 
       if (tmp_bfd == NULL)
 	goto bkpt_at_symbol;

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