From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WW35y-0007Q7-VL for qemu-devel@nongnu.org; Fri, 04 Apr 2014 08:19:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WW35p-0007OM-M0 for qemu-devel@nongnu.org; Fri, 04 Apr 2014 08:19:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39671) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WW35p-0007OA-Do for qemu-devel@nongnu.org; Fri, 04 Apr 2014 08:19:33 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s34CJWpI008676 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 4 Apr 2014 08:19:32 -0400 From: Kevin Wolf Date: Fri, 4 Apr 2014 14:19:29 +0200 Message-Id: <1396613969-22219-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH] qcow2: Put cache reference in error case List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com When qcow2_get_cluster_offset() sees a zero cluster in a version 2 image, it (rightfully) returns an error. But in doing so it shouldn't leak an L2 table cache reference. Signed-off-by: Kevin Wolf --- block/qcow2-cluster.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index 65550fd..54946c7 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -495,6 +495,7 @@ int qcow2_get_cluster_offset(BlockDriverState *bs, uint64_t offset, break; case QCOW2_CLUSTER_ZERO: if (s->qcow_version < 3) { + qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table); return -EIO; } c = count_contiguous_clusters(nb_clusters, s->cluster_size, -- 1.8.3.1