From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41723) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WV2Lo-0007AR-Cc for qemu-devel@nongnu.org; Tue, 01 Apr 2014 13:19:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WV2Li-0002Wk-4E for qemu-devel@nongnu.org; Tue, 01 Apr 2014 13:19:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:23384) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WV2Lh-0002Wg-SO for qemu-devel@nongnu.org; Tue, 01 Apr 2014 13:19:46 -0400 From: Stefan Hajnoczi Date: Tue, 1 Apr 2014 19:18:41 +0200 Message-Id: <1396372769-11688-4-git-send-email-stefanha@redhat.com> In-Reply-To: <1396372769-11688-1-git-send-email-stefanha@redhat.com> References: <1396372769-11688-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PULL for-2.0 03/51] qcow2: fix two memory leaks in qcow2_open error code path List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Prasad Joshi , Stefan Hajnoczi From: Prasad Joshi Signed-off-by: Prasad Joshi Reviewed-by: Max Reitz Signed-off-by: Stefan Hajnoczi --- block/qcow2.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/qcow2.c b/block/qcow2.c index b9dc960..10eccf9 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -506,6 +506,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, s->incompatible_features & ~QCOW2_INCOMPAT_MASK); ret = -ENOTSUP; + g_free(feature_table); goto fail; } @@ -745,6 +746,9 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, if (s->l2_table_cache) { qcow2_cache_destroy(bs, s->l2_table_cache); } + if (s->refcount_block_cache) { + qcow2_cache_destroy(bs, s->refcount_block_cache); + } g_free(s->cluster_cache); qemu_vfree(s->cluster_data); return ret; -- 1.9.0