From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3008 invoked by alias); 28 Feb 2011 15:57:53 -0000 Received: (qmail 3000 invoked by uid 22791); 28 Feb 2011 15:57:52 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,SPF_SOFTFAIL,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mtagate2.uk.ibm.com (HELO mtagate2.uk.ibm.com) (194.196.100.162) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 28 Feb 2011 15:57:47 +0000 Received: from d06nrmr1707.portsmouth.uk.ibm.com (d06nrmr1707.portsmouth.uk.ibm.com [9.149.39.225]) by mtagate2.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p1SFvZqj028861 for ; Mon, 28 Feb 2011 15:57:35 GMT Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1707.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p1SFvkan1728738 for ; Mon, 28 Feb 2011 15:57:46 GMT Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p1SFvZTt031094 for ; Mon, 28 Feb 2011 08:57:35 -0700 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id p1SFvX00031043; Mon, 28 Feb 2011 08:57:33 -0700 Message-Id: <201102281557.p1SFvX00031043@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Mon, 28 Feb 2011 16:57:33 +0100 Subject: Re: [commit] Compilation regression [Re: [RFA] Fix memory leak in gdbserver/hostio.c] To: jan.kratochvil@redhat.com (Jan Kratochvil) Date: Mon, 28 Feb 2011 16:00:00 -0000 From: "Ulrich Weigand" Cc: msnyder@vmware.com (Michael Snyder), pedro@codesourcery.com (Pedro Alves), gdb-patches@sourceware.org (gdb-patches@sourceware.org), drow@false.org (drow@false.org) In-Reply-To: <20110228042252.GA12861@host1.dyn.jankratochvil.net> from "Jan Kratochvil" at Feb 28, 2011 05:22:52 AM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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-02/txt/msg00909.txt.bz2 Jan Kratochvil wrote: > On Sun, 27 Feb 2011 22:50:11 +0100, Michael Snyder wrote: > > 2011-02-27 Michael Snyder > > > > * hostio.c (require_data): Free malloc memory before returning > > error. > > > > --- hostio.c 1 Jan 2011 15:33:24 -0000 1.11 > > +++ hostio.c 27 Feb 2011 21:48:00 -0000 > > @@ -134,7 +134,10 @@ require_data (char *p, int p_len, char * > > + xfree (data); > > = http://sourceware.org/ml/gdb-cvs/2011-02/msg00220.html > > hostio.c: In function ‘require_data’: > hostio.c:138:7: error: implicit declaration of function ‘xfree’ [-Werror=implicit-function-declaration] > cc1: all warnings being treated as errors > make: *** [hostio.o] Error 1 > > It could not build as -Werror is there by default, could it? > > Checked in the fix. Actually, this is still broken: /home/uweigand/fsf/gdb-head/gdb/gdbserver/hostio.c:138: error: attempt to free a non-heap object 'data' The allocated object is *data, not data (data is of type char ** here). Checked in the following fix. Bye, Ulrich ChangeLog: * hostio.c (require_data): Free *data, not data. Index: gdb/gdbserver/hostio.c =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/hostio.c,v retrieving revision 1.13 diff -u -p -r1.13 hostio.c --- gdb/gdbserver/hostio.c 28 Feb 2011 04:20:30 -0000 1.13 +++ gdb/gdbserver/hostio.c 28 Feb 2011 15:38:59 -0000 @@ -135,7 +135,7 @@ require_data (char *p, int p_len, char * if (escaped) { - free (data); + free (*data); return -1; } -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com