From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29919 invoked by alias); 20 Mar 2013 19:06:25 -0000 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 Received: (qmail 29867 invoked by uid 89); 20 Mar 2013 19:06:18 -0000 X-Spam-SWARE-Status: No, score=-7.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 20 Mar 2013 19:06:16 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2KJ6EDo011257 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 20 Mar 2013 15:06:15 -0400 Received: from valrhona.uglyboxes.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2KJ6DqM000743 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO) for ; Wed, 20 Mar 2013 15:06:14 -0400 Message-ID: <514A08A5.6020504@redhat.com> Date: Wed, 20 Mar 2013 19:14:00 -0000 From: Keith Seitz User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0 MIME-Version: 1.0 To: "gdb-patches@sourceware.org ml" Subject: [RFA] Stop leaking extra_string Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2013-03/txt/msg00766.txt.bz2 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 * 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);