fix up cleanup handling in internal_vproblem
authorTom Tromey <tromey@redhat.com>
Thu, 30 May 2013 17:01:16 +0000 (17:01 +0000)
committerTom Tromey <tromey@redhat.com>
Thu, 30 May 2013 17:01:16 +0000 (17:01 +0000)
internal_vproblem can return, so this introduces proper cleanup
handling there.  Otherwise it may make a cleanup that is leaked.

* utils.c (internal_vproblem): Call do_cleanups.

gdb/ChangeLog
gdb/utils.c

index 4f323851a17fdb7f28c4e5c2c621701f12f36f08..4005a63decf5393f08d9951ab4bec72ff4ae9ee5 100644 (file)
@@ -1,3 +1,7 @@
+2013-05-30  Tom Tromey  <tromey@redhat.com>
+
+       * utils.c (internal_vproblem): Call do_cleanups.
+
 2013-05-30  Tom Tromey  <tromey@redhat.com>
 
        * linespec.c (find_linespec_symbols): Don't reassign to 'cleanup'.
index 218faed0babed2b0f0d6643bd5bc55d324144ac4..c25dadfe286b686d3f40509518d4a9b130e9d095 100644 (file)
@@ -713,6 +713,7 @@ internal_vproblem (struct internal_problem *problem,
   int quit_p;
   int dump_core_p;
   char *reason;
+  struct cleanup *cleanup = make_cleanup (null_cleanup, NULL);
 
   /* Don't allow infinite error/warning recursion.  */
   {
@@ -821,6 +822,7 @@ internal_vproblem (struct internal_problem *problem,
     }
 
   dejavu = 0;
+  do_cleanups (cleanup);
 }
 
 static struct internal_problem internal_error_problem = {