Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: jan.kratochvil@redhat.com (Jan Kratochvil)
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)
Subject: Re: [commit] Compilation regression  [Re: [RFA] Fix memory leak in gdbserver/hostio.c]
Date: Mon, 28 Feb 2011 16:00:00 -0000	[thread overview]
Message-ID: <201102281557.p1SFvX00031043@d06av02.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <20110228042252.GA12861@host1.dyn.jankratochvil.net> from "Jan Kratochvil" at Feb 28, 2011 05:22:52 AM

Jan Kratochvil wrote:
> On Sun, 27 Feb 2011 22:50:11 +0100, Michael Snyder wrote:
> > 2011-02-27  Michael Snyder  <msnyder@vmware.com>
> > 
> > 	* 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 ^[$B!F^[(Brequire_data^[$B!G^[(B:
> hostio.c:138:7: error: implicit declaration of function ^[$B!F^[(Bxfree^[$B!G^[(B [-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


      reply	other threads:[~2011-02-28 15:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-27  0:40 [RFA] Fix memory leak in gdbserver/hostio.c Michael Snyder
2011-02-27 17:10 ` Pedro Alves
2011-02-27 21:57   ` Michael Snyder
2011-02-27 23:29     ` Pedro Alves
2011-02-28  4:39     ` [commit] Compilation regression [Re: [RFA] Fix memory leak in gdbserver/hostio.c] Jan Kratochvil
2011-02-28 16:00       ` Ulrich Weigand [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201102281557.p1SFvX00031043@d06av02.portsmouth.uk.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=msnyder@vmware.com \
    --cc=pedro@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox