From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20562 invoked by alias); 18 Nov 2006 23:07:01 -0000 Received: (qmail 20532 invoked from network); 18 Nov 2006 23:06:48 -0000 Received: from unknown (195.23.133.211) by sourceware.org with QMTP; 18 Nov 2006 23:06:48 -0000 Received: (qmail 22884 invoked from network); 18 Nov 2006 23:06:46 -0000 Received: from unknown (HELO mailfrt10.isp.novis.pt) ([195.23.133.202]) (envelope-sender ) by mailrly01.isp.novis.pt with compressed SMTP; 18 Nov 2006 23:06:46 -0000 Received: (qmail 23051 invoked from network); 18 Nov 2006 23:06:42 -0000 Received: from unknown (HELO [192.168.0.35]) ([195.23.225.206]) (envelope-sender ) by mailfrt10.isp.novis.pt with SMTP; 18 Nov 2006 23:06:42 -0000 Message-ID: <455F919A.2030900@portugalmail.pt> Date: Sat, 18 Nov 2006 23:07:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.8) Gecko/20061025 Thunderbird/1.5.0.8 Mnenhy/0.7.4.0 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: prologue-value.c memory leak fix. Content-Type: multipart/mixed; boundary="------------030301000200080407020307" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-11/txt/msg00202.txt.bz2 This is a multi-part message in MIME format. --------------030301000200080407020307 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 742 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 prologue-value.c (clear_entries): Fix memory leak. --------------030301000200080407020307 Content-Type: text/plain; name="prologue-value.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="prologue-value.c.diff" Content-length: 499 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); --------------030301000200080407020307--