fix two buglets in breakpoint.c
authorTom Tromey <tromey@redhat.com>
Thu, 30 May 2013 17:09:02 +0000 (17:09 +0000)
committerTom Tromey <tromey@redhat.com>
Thu, 30 May 2013 17:09:02 +0000 (17:09 +0000)
First, output_thread_groups leaks a cleanup along one return path.

Second, parse_cmd_to_aexpr could return without running its cleanups,
if there was an exception in a TRY_CATCH.

* breakpoint.c (output_thread_groups, parse_cmd_to_aexpr): Call
do_cleanups earlier.

gdb/ChangeLog
gdb/breakpoint.c

index 56be9230954c4b24ae585d80b72ab0b641cadcc8..94db23f62f4aabd5c219060aaa590c8e411d728b 100644 (file)
@@ -1,3 +1,8 @@
+2013-05-30  Tom Tromey  <tromey@redhat.com>
+
+       * breakpoint.c (output_thread_groups, parse_cmd_to_aexpr): Call
+       do_cleanups earlier.
+
 2013-05-30  Tom Tromey  <tromey@redhat.com>
 
        * machoread.c (macho_symfile_read): Assign first cleanup to
index b4d2f27b7b0c91ced72adfa116d4dc133896d3a4..b5025ac5dd6e6144466db8e2ba93d075dde0c55f 100644 (file)
@@ -2248,6 +2248,8 @@ parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
                          fpieces, nargs, argvec);
     }
 
+  do_cleanups (old_cleanups);
+
   if (ex.reason < 0)
     {
       /* If we got here, it means the command could not be parsed to a valid
@@ -2256,8 +2258,6 @@ parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
       return NULL;
     }
 
-  do_cleanups (old_cleanups);
-
   /* We have a valid agent expression, return it.  */
   return aexpr;
 }
@@ -5814,8 +5814,7 @@ output_thread_groups (struct ui_out *uiout,
                      VEC(int) *inf_num,
                      int mi_only)
 {
-  struct cleanup *back_to = make_cleanup_ui_out_list_begin_end (uiout,
-                                                               field_name);
+  struct cleanup *back_to;
   int is_mi = ui_out_is_mi_like_p (uiout);
   int inf;
   int i;
@@ -5825,6 +5824,8 @@ output_thread_groups (struct ui_out *uiout,
   if (!is_mi && mi_only)
     return;
 
+  back_to = make_cleanup_ui_out_list_begin_end (uiout, field_name);
+
   for (i = 0; VEC_iterate (int, inf_num, i, inf); ++i)
     {
       if (is_mi)
This page took 0.051464 seconds and 4 git commands to generate.