From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31624 invoked by alias); 11 Mar 2011 21:29:57 -0000 Received: (qmail 31616 invoked by uid 22791); 11 Mar 2011 21:29:56 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SHORT_BODY,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-outbound-2.vmware.com (HELO smtp-outbound-2.vmware.com) (65.115.85.73) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 11 Mar 2011 21:29:52 +0000 Received: from mailhost4.vmware.com (mailhost4.vmware.com [10.16.67.124]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id DD7DF1416D; Fri, 11 Mar 2011 13:29:50 -0800 (PST) Received: from msnyder-server.eng.vmware.com (promd-2s-dhcp138.eng.vmware.com [10.20.124.138]) by mailhost4.vmware.com (Postfix) with ESMTP id CBF9FC9DE4; Fri, 11 Mar 2011 13:29:50 -0800 (PST) Message-ID: <4D7A944E.20801@vmware.com> Date: Fri, 11 Mar 2011 21:42:00 -0000 From: Michael Snyder User-Agent: Thunderbird 2.0.0.24 (X11/20110128) MIME-Version: 1.0 To: "gdb-patches@sourceware.org" , "tromey@redhat.com" Subject: [RFA] python/py-breakpoint.c (bppy_set_condition): Stop memory leak. Content-Type: multipart/mixed; boundary="------------030401040603020802030107" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-03/txt/msg00675.txt.bz2 This is a multi-part message in MIME format. --------------030401040603020802030107 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 5 OK? --------------030401040603020802030107 Content-Type: text/plain; name="py-breakpoint3.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="py-breakpoint3.txt" Content-length: 1110 2011-03-11 Michael Snyder * 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; } --------------030401040603020802030107--