From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46266) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsfkG-0005oi-Eo for qemu-devel@nongnu.org; Thu, 05 Jun 2014 18:02:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WsfkB-00038U-H4 for qemu-devel@nongnu.org; Thu, 05 Jun 2014 18:02:48 -0400 Received: from mail-qg0-f51.google.com ([209.85.192.51]:36382) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsfkB-00038F-Cm for qemu-devel@nongnu.org; Thu, 05 Jun 2014 18:02:43 -0400 Received: by mail-qg0-f51.google.com with SMTP id q107so2804130qgd.10 for ; Thu, 05 Jun 2014 15:02:42 -0700 (PDT) Message-ID: <5390E8F8.2080504@inktank.com> Date: Thu, 05 Jun 2014 15:02:32 -0700 From: Josh Durgin MIME-Version: 1.0 References: <1401977966-11664-1-git-send-email-kwolf@redhat.com> In-Reply-To: <1401977966-11664-1-git-send-email-kwolf@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] rbd: Fix leaks in rbd_start_aio() error path List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-devel@nongnu.org Cc: benoit.canet@irqsave.net, stefanha@redhat.com On 06/05/2014 07:19 AM, Kevin Wolf wrote: > Signed-off-by: Kevin Wolf > --- > block/rbd.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/block/rbd.c b/block/rbd.c > index 09af484..898fcfe 100644 > --- a/block/rbd.c > +++ b/block/rbd.c > @@ -684,13 +684,16 @@ static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs, > } > > if (r < 0) { > - goto failed; > + goto failed_completion; > } > > return &acb->common; > > +failed_completion: > + rbd_aio_release(c); > failed: > g_free(rcb); > + qemu_vfree(acb->bounce); > qemu_aio_release(acb); > return NULL; > } > Reviewed-by: Josh Durgin FWIW this error path can only happen in certain combinations of odd circumstances, including specific forms of disk corruption of certain objects in concert with other factors, so it's quite unlikely to occur in practice.