2007-08-08 Michael Snyder <msnyder@access-company.com>
authorMichael Snyder <msnyder@vmware.com>
Wed, 8 Aug 2007 18:08:52 +0000 (18:08 +0000)
committerMichael Snyder <msnyder@vmware.com>
Wed, 8 Aug 2007 18:08:52 +0000 (18:08 +0000)
* solib-svr4.c (open_symbol_file_object): Memory leak.
(svr4_current_sos): Ditto.
(enable_break): Ditto.

gdb/ChangeLog
gdb/solib-svr4.c

index 5b9036ab8a9fc5440e0f0b4bdd5865af87ff33eb..900d5c2b53e03c9e0759c304892ec98b16df2b3c 100644 (file)
@@ -1,5 +1,9 @@
 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.
+
        * cp-valprint.c (cp_print_hpacc_virtual_table_entries): Memory leak.
 
        * dwarf2read.c (add_partial_symbol): Memory leak.
index fc608de79f4193e09a0efb41141f0e540cf323f2..9b72a57bc0d027b6a180a870f6df87b5faa1e89f 100644 (file)
@@ -623,6 +623,7 @@ open_symbol_file_object (void *from_ttyp)
 
   /* Now fetch the filename from target memory.  */
   target_read_string (l_name, &filename, SO_NAME_MAX_PATH_SIZE - 1, &errcode);
+  make_cleanup (xfree, filename);
 
   if (errcode)
     {
@@ -631,7 +632,6 @@ open_symbol_file_object (void *from_ttyp)
       return 0;
     }
 
-  make_cleanup (xfree, filename);
   /* Have a pathname: read the symbol file.  */
   symbol_file_add_main (filename, from_tty);
 
@@ -751,9 +751,9 @@ svr4_current_sos (void)
            {
              strncpy (new->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
              new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
-             xfree (buffer);
              strcpy (new->so_original_name, new->so_name);
            }
+         xfree (buffer);
 
          /* If this entry has no name, or its name matches the name
             for the main executable, don't include it in the list.  */
@@ -1008,6 +1008,7 @@ enable_break (void)
       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;