From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7574 invoked by alias); 5 Aug 2007 03:02:43 -0000 Received: (qmail 7388 invoked by uid 22791); 5 Aug 2007 03:02:41 -0000 X-Spam-Check-By: sourceware.org Received: from b.mail.sonic.net (HELO b.mail.sonic.net) (64.142.19.5) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 05 Aug 2007 03:02:39 +0000 Received: from webmail.sonic.net (b.webmail.sonic.net [64.142.100.148]) by b.mail.sonic.net (8.13.8.Beta0-Sonic/8.13.7) with ESMTP id l7532bSJ021977 for ; Sat, 4 Aug 2007 20:02:37 -0700 Received: from 12.7.175.2 (SquirrelMail authenticated user msnyder) by webmail.sonic.net with HTTP; Sat, 4 Aug 2007 20:02:37 -0700 (PDT) Message-ID: <23585.12.7.175.2.1186282957.squirrel@webmail.sonic.net> Date: Sun, 05 Aug 2007 03:02:00 -0000 Subject: [PATCH] solib-svr4.c, several memory leaks From: msnyder@sonic.net To: gdb-patches@sourceware.org User-Agent: SquirrelMail/1.4.9a MIME-Version: 1.0 Content-Type: multipart/mixed;boundary="----=_20070804200237_19294" Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-08/txt/msg00096.txt.bz2 ------=_20070804200237_19294 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Content-length: 0 ------=_20070804200237_19294 Content-Type: text/plain; name="143-144-145.txt" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="143-144-145.txt" Content-length: 2077 2007-08-04 Michael Snyder * solib-svr4.c (open_symbol_file_object): Memory leak. (svr4_current_sos): Ditto. (enable_break): Ditto. Index: solib-svr4.c =================================================================== RCS file: /cvs/src/src/gdb/solib-svr4.c,v retrieving revision 1.71 diff -p -r1.71 solib-svr4.c *** solib-svr4.c 25 Jul 2007 02:12:33 -0000 1.71 --- solib-svr4.c 5 Aug 2007 02:59:55 -0000 *************** open_symbol_file_object (void *from_ttyp *** 623,628 **** --- 623,629 ---- /* 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) { *************** open_symbol_file_object (void *from_ttyp *** 631,637 **** return 0; } - make_cleanup (xfree, filename); /* Have a pathname: read the symbol file. */ symbol_file_add_main (filename, from_tty); --- 632,637 ---- *************** svr4_current_sos (void) *** 751,759 **** { 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); } /* If this entry has no name, or its name matches the name for the main executable, don't include it in the list. */ --- 751,759 ---- { strncpy (new->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1); new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; 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. */ *************** enable_break (void) *** 1008,1013 **** --- 1008,1014 ---- 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; ------=_20070804200237_19294--