From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:53156) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3Sbr-0005F6-DW for qemu-devel@nongnu.org; Mon, 20 Aug 2012 10:05:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T3Sbl-0004X4-Eu for qemu-devel@nongnu.org; Mon, 20 Aug 2012 10:05:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58464) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3Sbl-0004WG-5i for qemu-devel@nongnu.org; Mon, 20 Aug 2012 10:05:33 -0400 Date: Mon, 20 Aug 2012 11:05:31 -0300 From: Luiz Capitulino Message-ID: <20120820110531.2a0f6501@doriath.home> In-Reply-To: <5030BC0D.5010900@redhat.com> References: <1345323089-26232-1-git-send-email-sw@weilnetz.de> <5030BC0D.5010900@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qapi: Fix memory leak List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laszlo Ersek Cc: Stefan Weil , qemu-devel@nongnu.org On Sun, 19 Aug 2012 12:12:29 +0200 Laszlo Ersek wrote: > On 08/18/12 22:51, Stefan Weil wrote: > > valgrind report: > > > > ==24534== 232 bytes in 2 blocks are definitely lost in loss record 1,245 of 1,601 > > ==24534== at 0x4824F20: malloc (vg_replace_malloc.c:236) > > ==24534== by 0x293C88: malloc_and_trace (vl.c:2281) > > ==24534== by 0x489AD99: ??? (in /lib/libglib-2.0.so.0.2400.1) > > ==24534== by 0x489B23B: g_malloc0 (in /lib/libglib-2.0.so.0.2400.1) > > ==24534== by 0x2B4EFC: opts_visitor_new (opts-visitor.c:376) > > ==24534== by 0x29DEA5: net_client_init (net.c:708) > > ==24534== by 0x29E6C7: net_init_client (net.c:966) > > ==24534== by 0x2C2179: qemu_opts_foreach (qemu-option.c:1114) > > ==24534== by 0x29E85B: net_init_clients (net.c:1008) > > ==24534== by 0x296F40: main (vl.c:3463) > > > > Signed-off-by: Stefan Weil > > --- > > qapi/opts-visitor.c | 2 +- > > 1 files changed, 1 insertions(+), 1 deletions(-) > > > > diff --git a/qapi/opts-visitor.c b/qapi/opts-visitor.c > > index a59d306..e048b6c 100644 > > --- a/qapi/opts-visitor.c > > +++ b/qapi/opts-visitor.c > > @@ -416,7 +416,7 @@ opts_visitor_cleanup(OptsVisitor *ov) > > g_hash_table_destroy(ov->unprocessed_opts); > > } > > g_free(ov->fake_id_opt); > > - memset(ov, '\0', sizeof *ov); > > + g_free(ov); > > } > > > > > > I don't remember why I thought the object would / should live on. I must > have implemented what I thought was safe / correct for the life-cycle, > except I got the life-cycle wrong. Face, meet palm. > > Reviewed-by: Laszlo Ersek Applied to the qmp branch for 1.2.