From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zu3G4-0004Lk-2q for qemu-devel@nongnu.org; Wed, 04 Nov 2015 13:58:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zu3G3-0006rg-8Y for qemu-devel@nongnu.org; Wed, 04 Nov 2015 13:58:08 -0500 From: Max Reitz Date: Wed, 4 Nov 2015 19:57:34 +0100 Message-Id: <1446663467-22485-3-git-send-email-mreitz@redhat.com> In-Reply-To: <1446663467-22485-1-git-send-email-mreitz@redhat.com> References: <1446663467-22485-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH v6 02/15] blockjob: Call bdrv_unref() on creation error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: Kevin Wolf , Alberto Garcia , Markus Armbruster , qemu-devel@nongnu.org, Stefan Hajnoczi , Paolo Bonzini , Max Reitz If block_job_create() fails, it should release its reference to the job's BDS. Normally, this is done in the callback provided by the caller, but that callback will not be invoked if the block job failed to be created. Signed-off-by: Max Reitz --- blockjob.c | 1 + 1 file changed, 1 insertion(+) diff --git a/blockjob.c b/blockjob.c index c02fe59..0886a4a 100644 --- a/blockjob.c +++ b/blockjob.c @@ -70,6 +70,7 @@ void *block_job_create(const BlockJobDriver *driver, BlockDriverState *bs, if (local_err) { block_job_release(bs); error_propagate(errp, local_err); + bdrv_unref(bs); return NULL; } } -- 2.6.2