From: msnyder@sonic.net
To: gdb-patches@sourceware.org
Subject: [PATCH] solib-svr4.c, several memory leaks
Date: Sun, 05 Aug 2007 03:02:00 -0000 [thread overview]
Message-ID: <23585.12.7.175.2.1186282957.squirrel@webmail.sonic.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2: 143-144-145.txt --]
[-- Type: text/plain, Size: 2077 bytes --]
2007-08-04 Michael Snyder <msnyder@access-company.com>
* 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;
next reply other threads:[~2007-08-05 3:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-05 3:02 msnyder [this message]
2007-08-06 22:14 ` Jim Blandy
2007-08-06 22:43 ` Kevin Buettner
2007-08-08 18:09 ` msnyder
2007-08-09 22:45 ` Luis Machado
[not found] ` <1186699391.4524.12.camel@localhost>
2007-08-09 23:39 ` msnyder
2007-08-10 0:13 ` msnyder
2007-08-10 7:16 ` Markus Deuling
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=23585.12.7.175.2.1186282957.squirrel@webmail.sonic.net \
--to=msnyder@sonic.net \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox