From patchwork Mon Sep 8 10:51:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 386871 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C9EF91400B2 for ; Mon, 8 Sep 2014 20:58:09 +1000 (EST) Received: from localhost ([::1]:42293 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XQwe8-0004mp-1Z for incoming@patchwork.ozlabs.org; Mon, 08 Sep 2014 06:58:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38905) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XQwYz-0004I1-Sd for qemu-devel@nongnu.org; Mon, 08 Sep 2014 06:52:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XQwYt-0007ye-Oy for qemu-devel@nongnu.org; Mon, 08 Sep 2014 06:52:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9654) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XQwYt-0007yE-HZ for qemu-devel@nongnu.org; Mon, 08 Sep 2014 06:52:43 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s88AqfJd006750 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 8 Sep 2014 06:52:41 -0400 Received: from localhost (ovpn-112-62.ams2.redhat.com [10.36.112.62]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s88AqeUO022836; Mon, 8 Sep 2014 06:52:41 -0400 From: Stefan Hajnoczi To: Date: Mon, 8 Sep 2014 11:51:46 +0100 Message-Id: <1410173509-26667-22-git-send-email-stefanha@redhat.com> In-Reply-To: <1410173509-26667-1-git-send-email-stefanha@redhat.com> References: <1410173509-26667-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Maydell , Stefan Hajnoczi Subject: [Qemu-devel] [PULL 21/24] vmdk: fix vmdk_parse_extents() extent_file leaks X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Stefan Hajnoczi Reviewed-by: Max Reitz Reviewed-by: Fam Zheng --- block/vmdk.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block/vmdk.c b/block/vmdk.c index 07cb62c..9bf28f3 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -834,6 +834,7 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, ret = vmdk_add_extent(bs, extent_file, true, sectors, 0, 0, 0, 0, 0, &extent, errp); if (ret < 0) { + bdrv_unref(extent_file); return ret; } extent->flat_start_offset = flat_offset << 9; @@ -853,6 +854,7 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, extent = &s->extents[s->num_extents - 1]; } else { error_setg(errp, "Unsupported extent type '%s'", type); + bdrv_unref(extent_file); return -ENOTSUP; } extent->type = g_strdup(type);