From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:39988) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tv6w2-0000Vo-0b for qemu-devel@nongnu.org; Tue, 15 Jan 2013 08:52:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tv6vx-0003nv-Dh for qemu-devel@nongnu.org; Tue, 15 Jan 2013 08:52:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41717) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tv6vx-0003nn-6M for qemu-devel@nongnu.org; Tue, 15 Jan 2013 08:52:09 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0FDq8NW025658 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 15 Jan 2013 08:52:08 -0500 Message-ID: <50F55F06.60402@redhat.com> Date: Tue, 15 Jan 2013 14:52:06 +0100 From: Kevin Wolf MIME-Version: 1.0 References: <1358256220-5460-1-git-send-email-armbru@redhat.com> <1358256220-5460-5-git-send-email-armbru@redhat.com> In-Reply-To: <1358256220-5460-5-git-send-email-armbru@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 4/4] block: Fix how mirror_run() frees its buffer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com Am 15.01.2013 14:23, schrieb Markus Armbruster: > It allocates with qemu_blockalign(), therefore it must free with > qemu_vfree(), not g_free(). > > Since I'm touching it anyway, move the free to a more obviosly correct > place. ...except that it's now leaked for all error cases but the first. Kevin > Signed-off-by: Markus Armbruster > --- > block/mirror.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/block/mirror.c b/block/mirror.c > index 8aeacbf..27a7d8c 100644 > --- a/block/mirror.c > +++ b/block/mirror.c > @@ -223,9 +223,9 @@ static void coroutine_fn mirror_run(void *opaque) > break; > } > } > + qemu_vfree(s->buf); > > immediate_exit: > - g_free(s->buf); > bdrv_set_dirty_tracking(bs, false); > bdrv_iostatus_disable(s->target); > if (s->should_complete && ret == 0) { >