From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39713) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnVOc-0002H5-3P for qemu-devel@nongnu.org; Thu, 22 May 2014 11:59:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WnVOW-0001fr-0K for qemu-devel@nongnu.org; Thu, 22 May 2014 11:59:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42296) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnVOV-0001fn-OT for qemu-devel@nongnu.org; Thu, 22 May 2014 11:58:59 -0400 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 s4MFwvk8020741 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 22 May 2014 11:58:58 -0400 Date: Thu, 22 May 2014 17:58:56 +0200 From: Stefan Hajnoczi Message-ID: <20140522155856.GI21238@stefanha-thinkpad.redhat.com> References: <1400689698-3096-1-git-send-email-kwolf@redhat.com> <1400689698-3096-8-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1400689698-3096-8-git-send-email-kwolf@redhat.com> Subject: Re: [Qemu-devel] [PATCH 07/20] iscsi: Handle failure for potentially large allocations List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org On Wed, May 21, 2014 at 06:28:05PM +0200, Kevin Wolf wrote: > @@ -550,7 +553,11 @@ static BlockDriverAIOCB *iscsi_aio_ioctl(BlockDriverState *bs, > #else > struct iovec *iov = (struct iovec *)acb->ioh->dxferp; > > - acb->buf = g_malloc(acb->ioh->dxfer_len); > + acb->buf = g_try_malloc(acb->ioh->dxfer_len); > + if (acb->buf == NULL) { > + qemu_aio_release(acb); > + return NULL; > + } Leaks acb->task which happens to be malloc(3) allocated :(.