Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: "gdb-patches@sourceware.org ml" <gdb-patches@sourceware.org>
Subject: [RFA] Stop leaking extra_string
Date: Wed, 20 Mar 2013 19:14:00 -0000	[thread overview]
Message-ID: <514A08A5.6020504@redhat.com> (raw)

Hi,

While reviewing my own patches, I noticed that struct 
breakpoint.extra_string is never freed. You can see this fairly easily 
in mi-breakpoint-changed.exp (or any dprintf) with valgrind (or an 
assert in base_breakpoint_dtor).

I've also added a comment to breakpoint.h to mention that this member is 
allocated.

Ok?
Keith

ChangeLog
2013-03-20  Keith Seitz  <keiths@redhat.com>

	* breakpoint.h (struct breakpoint): Add comment to
	extra_string indicating that this member is mallod'd.
	* breakpoint.c (base_breakpoint_dtor): Free extra_string.


Index: breakpoint.h
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.h,v
retrieving revision 1.193
diff -u -p -r1.193 breakpoint.h
--- breakpoint.h	3 Feb 2013 15:57:06 -0000	1.193
+++ breakpoint.h	20 Mar 2013 14:31:28 -0000
@@ -726,7 +726,8 @@ struct breakpoint
         there is no condition.  */
      char *cond_string;

-    /* String form of extra parameters, or NULL if there are none.  */
+    /* String form of extra parameters, or NULL if there are none.
+     Malloc'd.  */
      char *extra_string;

      /* Holds the address of the related watchpoint_scope breakpoint
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.746
diff -u -p -r1.746 breakpoint.c
--- breakpoint.c	13 Mar 2013 18:34:53 -0000	1.746
+++ breakpoint.c	20 Mar 2013 14:31:29 -0000
@@ -12788,6 +12788,7 @@ base_breakpoint_dtor (struct breakpoint
  {
    decref_counted_command_line (&self->commands);
    xfree (self->cond_string);
+  xfree (self->extra_string);
    xfree (self->addr_string);
    xfree (self->filter);
    xfree (self->addr_string_range_end);


             reply	other threads:[~2013-03-20 19:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-20 19:14 Keith Seitz [this message]
2013-03-20 19:23 ` Pedro Alves
2013-03-21  0:42   ` Keith Seitz
2013-03-22 20:13     ` Pedro Alves

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=514A08A5.6020504@redhat.com \
    --to=keiths@redhat.com \
    --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