From: Pedro Alves <pedro_alves@portugalmail.pt>
To: gdb-patches@sourceware.org
Subject: prologue-value.c memory leak fix.
Date: Sat, 18 Nov 2006 23:07:00 -0000 [thread overview]
Message-ID: <455F919A.2030900@portugalmail.pt> (raw)
[-- Attachment #1: Type: text/plain, Size: 742 bytes --]
There is a leak in prologue-value.c, in clear_values:
The do while loop always runs exactly once.
The attached patch fixes it.
/* Delete all entries from AREA. */
static void
clear_entries (struct pv_area *area)
{
struct area_entry *e = area->entry;
if (e)
{
/* This needs to be a do-while loop, in order to actually
process the node being checked for in the terminating
condition. */
do
{
struct area_entry *next = e->next;
xfree (e);
}
while (e != area->entry);
area->entry = 0;
}
}
Please review and commit.
Cheers,
Pedro Alves
---
2006-11-18 Pedro Alves <pedro_alves@portugalmail.pt>
prologue-value.c (clear_entries): Fix memory leak.
[-- Attachment #2: prologue-value.c.diff --]
[-- Type: text/plain, Size: 499 bytes --]
Index: prologue-value.c
===================================================================
RCS file: /cvs/src/src/gdb/prologue-value.c,v
retrieving revision 1.2
diff -u -p -r1.2 prologue-value.c
--- prologue-value.c 28 Mar 2006 19:19:16 -0000 1.2
+++ prologue-value.c 18 Nov 2006 23:00:35 -0000
@@ -351,6 +351,7 @@ clear_entries (struct pv_area *area)
{
struct area_entry *next = e->next;
xfree (e);
+ e = next;
}
while (e != area->entry);
next reply other threads:[~2006-11-18 23:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-18 23:07 Pedro Alves [this message]
2006-11-18 23:57 ` 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=455F919A.2030900@portugalmail.pt \
--to=pedro_alves@portugalmail.pt \
--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