[commit/obv] symtab.c: Wrap/cleanup dangling make_cleanup

Jan Kratochvil jan.kratochvil@redhat.com
Thu Jan 17 19:57:00 GMT 2013


Hi,

checked in.

No regressions on {x86_64,x86_64-m32,i686}-fedora18-linux-gnu.


Thanks,
Jan


http://sourceware.org/ml/gdb-cvs/2013-01/msg00101.html

--- src/gdb/ChangeLog	2013/01/17 16:27:26	1.15028
+++ src/gdb/ChangeLog	2013/01/17 19:55:16	1.15029
@@ -1,3 +1,8 @@
+2013-01-17  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* symtab.c (iterate_over_some_symtabs): New variable cleanups,
+	initialize it by existing make_cleanup.  Call new do_cleanups.
+
 2013-01-17  Tom Tromey  <tromey@redhat.com>
 
 	* cp-abi.c (cp_abi_completer): New function.
--- src/gdb/symtab.c	2013/01/09 20:46:03	1.336
+++ src/gdb/symtab.c	2013/01/17 19:55:18	1.337
@@ -241,19 +241,26 @@
       {
         const char *fullname = symtab_to_fullname (s);
 	char *rp = gdb_realpath (fullname);
+	struct cleanup *cleanups = make_cleanup (xfree, rp);
 
-	make_cleanup (xfree, rp);
 	if (FILENAME_CMP (real_path, rp) == 0)
 	  {
 	    if (callback (s, data))
-	      return 1;
+	      {
+		do_cleanups (cleanups);
+		return 1;
+	      }
 	  }
 
 	if (!is_abs && compare_filenames_for_search (rp, name))
 	  {
 	    if (callback (s, data))
-	      return 1;
+	      {
+		do_cleanups (cleanups);
+		return 1;
+	      }
 	  }
+	do_cleanups (cleanups);
       }
     }
 



More information about the Gdb-patches mailing list