From: Nick Roberts <nickrob@snap.net.nz>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] Fix small memory leak in mi-cmd-var.c
Date: Fri, 08 Dec 2006 02:10:00 -0000 [thread overview]
Message-ID: <17784.51326.623302.154956@kahikatea.snap.net.nz> (raw)
This patch fixes a small memory leak (sizeof (struct varobj *) = 4)
that occurs each time -var-update is issued when rootcount = 0.
--
Nick http://www.inet.net.nz/~nickrob
2006-12-08 Nick Roberts <nickrob@snap.net.nz>
* mi/mi-cmd-var.c (mi_cmd_var_update): Fix memory leak.
*** mi-cmd-var.c 30 Nov 2006 11:45:31 +1300 1.26
--- mi-cmd-var.c 08 Dec 2006 15:04:16 +1300
*************** mi_cmd_var_update (char *command, char *
*** 500,509 ****
if ((*name == '*') && (*(name + 1) == '\0'))
{
nv = varobj_list (&rootlist);
if (mi_version (uiout) <= 1)
! cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, "changelist");
else
! cleanup = make_cleanup_ui_out_list_begin_end (uiout, "changelist");
if (nv <= 0)
{
do_cleanups (cleanup);
--- 500,510 ----
if ((*name == '*') && (*(name + 1) == '\0'))
{
nv = varobj_list (&rootlist);
+ cleanup = make_cleanup (xfree, rootlist);
if (mi_version (uiout) <= 1)
! make_cleanup_ui_out_tuple_begin_end (uiout, "changelist");
else
! make_cleanup_ui_out_list_begin_end (uiout, "changelist");
if (nv <= 0)
{
do_cleanups (cleanup);
*************** mi_cmd_var_update (char *command, char *
*** 515,521 ****
varobj_update_one (*cr, print_values);
cr++;
}
- xfree (rootlist);
do_cleanups (cleanup);
}
else
--- 516,521 ----
next reply other threads:[~2006-12-08 2:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-08 2:10 Nick Roberts [this message]
2006-12-08 3:30 ` Daniel Jacobowitz
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=17784.51326.623302.154956@kahikatea.snap.net.nz \
--to=nickrob@snap.net.nz \
--cc=gdb-patches@sources.redhat.com \
/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