From: Michael Snyder <msnyder@vmware.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
"tromey@redhat.com" <tromey@redhat.com>
Subject: [RFA] python/py-breakpoint.c (bppy_set_condition): Stop memory leak.
Date: Fri, 11 Mar 2011 21:42:00 -0000 [thread overview]
Message-ID: <4D7A944E.20801@vmware.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 5 bytes --]
OK?
[-- Attachment #2: py-breakpoint3.txt --]
[-- Type: text/plain, Size: 1110 bytes --]
2011-03-11 Michael Snyder <msnyder@vmware.com>
* python/py-breakpoint.c (bppy_set_condition): Stop memory leak.
Index: python/py-breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-breakpoint.c,v
retrieving revision 1.14
diff -u -p -r1.14 py-breakpoint.c
--- python/py-breakpoint.c 4 Feb 2011 21:54:16 -0000 1.14
+++ python/py-breakpoint.c 11 Mar 2011 21:26:29 -0000
@@ -435,6 +435,7 @@ bppy_set_condition (PyObject *self, PyOb
char *exp;
breakpoint_object *self_bp = (breakpoint_object *) self;
volatile struct gdb_exception except;
+ struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
BPPY_SET_REQUIRE_VALID (self_bp);
@@ -451,6 +452,7 @@ bppy_set_condition (PyObject *self, PyOb
exp = python_string_to_host_string (newvalue);
if (exp == NULL)
return -1;
+ make_cleanup (xfree, exp);
}
TRY_CATCH (except, RETURN_MASK_ALL)
@@ -459,6 +461,7 @@ bppy_set_condition (PyObject *self, PyOb
}
GDB_PY_SET_HANDLE_EXCEPTION (except);
+ do_cleanups (cleanups);
return 0;
}
next reply other threads:[~2011-03-11 21:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-11 21:42 Michael Snyder [this message]
2011-03-11 21:57 ` Tom Tromey
2011-03-11 22:01 ` Michael Snyder
2011-03-11 22:05 ` Tom Tromey
2011-03-11 22:16 ` Michael Snyder
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=4D7A944E.20801@vmware.com \
--to=msnyder@vmware.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@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