* linespec.c (decode_objc): Add cleanup to free
authorKeith Seitz <keiths@redhat.com>
Thu, 31 May 2012 18:44:50 +0000 (18:44 +0000)
committerKeith Seitz <keiths@redhat.com>
Thu, 31 May 2012 18:44:50 +0000 (18:44 +0000)
INFO.FILE_SYMTABS.
(find_linespec_symbols): Add cleanup to free CLASSES.
* symfile.c (find_separate_debug_file_by_debuglink): Add
cleanup to free DEBUGLINK.
* ui-out.c (clear_header_list): No need to check if
HEADER_NEXT.COLHDR is NULL.
Free HEADER_NEXT.COL_NAME.

gdb/ChangeLog
gdb/linespec.c
gdb/symfile.c
gdb/ui-out.c

index c09c95431f44ade98b4334bae00a4c92a5fd4b82..e2ca89fd4c19c76276e0ebe6123b840496b76a91 100644 (file)
@@ -1,3 +1,14 @@
+2012-05-31  Keith Seitz  <keiths@redhat.com>
+
+       * linespec.c (decode_objc): Add cleanup to free
+       INFO.FILE_SYMTABS.
+       (find_linespec_symbols): Add cleanup to free CLASSES.
+       * symfile.c (find_separate_debug_file_by_debuglink): Add
+       cleanup to free DEBUGLINK.
+       * ui-out.c (clear_header_list): No need to check if
+       HEADER_NEXT.COLHDR is NULL.
+       Free HEADER_NEXT.COL_NAME.
+
 2012-05-31  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
 
        * ada-lang.c (standard_lookup): Prevent uninitialized variable
index ee91adfa6a5ed3ea8f1e301134a7694ad96f5256..e678dfa10082840f9e191ea15ac782072f518279 100644 (file)
@@ -2409,6 +2409,7 @@ decode_objc (struct linespec_state *self, linespec_p ls, char **argptr)
   info.state = self;
   info.file_symtabs = NULL;
   VEC_safe_push (symtab_p, info.file_symtabs, NULL);
+  make_cleanup (VEC_cleanup (symtab_p), &info.file_symtabs);
   info.result.symbols = NULL;
   info.result.minimal_symbols = NULL;
   values.nelts = 0;
@@ -2949,6 +2950,7 @@ find_linespec_symbols (struct linespec_state *state,
 
   /* Find a list of classes named KLASS.  */
   classes = lookup_prefix_sym (state, file_symtabs, klass);
+  make_cleanup (VEC_cleanup (symbolp), &classes);
   if (!VEC_empty (symbolp, classes))
     {
       /* Now locate a list of suitable methods named METHOD.  */
index 31da4e4842d86294e5589dc25a6b2cafd622a2eb..37d98d984ea6d44f1b0e47ca4ee51e6b39c921ce 100644 (file)
@@ -1553,8 +1553,9 @@ find_separate_debug_file_by_debuglink (struct objfile *objfile)
       return NULL;
     }
 
+  cleanups = make_cleanup (xfree, debuglink);
   dir = xstrdup (objfile->name);
-  cleanups = make_cleanup (xfree, dir);
+  make_cleanup (xfree, dir);
   terminate_after_last_dir_separator (dir);
   canon_dir = lrealpath (dir);
 
index aa53f3ffea5459d46323295141195347bd8cadbe..ec68cdd21533512b506cfb4d81b2059c365713b6 100644 (file)
@@ -968,8 +968,8 @@ clear_header_list (struct ui_out *uiout)
     {
       uiout->table.header_next = uiout->table.header_first;
       uiout->table.header_first = uiout->table.header_first->next;
-      if (uiout->table.header_next->colhdr != NULL)
-       xfree (uiout->table.header_next->colhdr);
+      xfree (uiout->table.header_next->colhdr);
+      xfree (uiout->table.header_next->col_name);
       xfree (uiout->table.header_next);
     }
   gdb_assert (uiout->table.header_first == NULL);