From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9682 invoked by alias); 3 Jan 2005 13:49:53 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 9622 invoked from network); 3 Jan 2005 13:49:44 -0000 Received: from unknown (HELO Cantor.suse.de) (195.135.220.2) by sourceware.org with SMTP; 3 Jan 2005 13:49:44 -0000 Received: from hermes.suse.de (hermes-ext.suse.de [195.135.221.8]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by Cantor.suse.de (Postfix) with ESMTP id D578E12C4A5E for ; Mon, 3 Jan 2005 14:49:43 +0100 (CET) To: gdb-patches@sources.redhat.com Subject: Fix memory leak in break command From: Andreas Schwab X-Yow: Mr and Mrs PED, can I borrow 26.7% of the RAYON TEXTILE production of the INDONESIAN archipelago? Date: Mon, 03 Jan 2005 13:49:00 -0000 Message-ID: User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-SW-Source: 2005-01/txt/msg00007.txt.bz2 Found this by code inspection. Andreas. 2005-01-03 Andreas Schwab * breakpoint.c (break_command_1): Always free err_msg before returning when an exception was caught. Index: gdb/breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.186 diff -u -p -a -u -p -a -r1.186 gdb/breakpoint.c --- gdb/breakpoint.c 1 Dec 2004 06:54:56 -0000 1.186 +++ gdb/breakpoint.c 3 Jan 2005 13:45:20 -0000 @@ -5141,7 +5141,10 @@ break_command_1 (char *arg, int flag, in { /* If called to resolve pending breakpoint, just return error code. */ if (pending_bp) - return rc; + { + xfree (err_msg); + return rc; + } error_output_message (NULL, err_msg); xfree (err_msg); @@ -5169,7 +5172,10 @@ break_command_1 (char *arg, int flag, in pending = 1; } else - return rc; + { + xfree (err_msg); + return rc; + } } else if (!sals.nelts) return GDB_RC_FAIL; -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."