From patchwork Thu Dec 9 11:09:59 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 74912 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 20EA6B6F14 for ; Fri, 10 Dec 2010 02:46:52 +1100 (EST) Received: from localhost ([127.0.0.1]:46654 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQihk-0008Qs-8A for incoming@patchwork.ozlabs.org; Thu, 09 Dec 2010 10:46:48 -0500 Received: from [140.186.70.92] (port=44545 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQeN5-0006G8-UG for qemu-devel@nongnu.org; Thu, 09 Dec 2010 06:09:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PQeN4-0000Fo-Um for qemu-devel@nongnu.org; Thu, 09 Dec 2010 06:09:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:5010) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PQeN4-0000EH-HI for qemu-devel@nongnu.org; Thu, 09 Dec 2010 06:09:10 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oB9B99M1005619 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 9 Dec 2010 06:09:09 -0500 Received: from dhcp-5-188.str.redhat.com (dhcp-5-175.str.redhat.com [10.32.5.175]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oB9B91np014178; Thu, 9 Dec 2010 06:09:08 -0500 From: Kevin Wolf To: anthony@codemonkey.ws Date: Thu, 9 Dec 2010 12:09:59 +0100 Message-Id: <1291893010-29223-4-git-send-email-kwolf@redhat.com> In-Reply-To: <1291893010-29223-1-git-send-email-kwolf@redhat.com> References: <1291893010-29223-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 03/14] Use qemu_mallocz() instead of calloc() in img_convert() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jes Sorensen Signed-off-by: Jes Sorensen Signed-off-by: Kevin Wolf --- qemu-img.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index fa77ac0..eca99c4 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -699,11 +699,7 @@ static int img_convert(int argc, char **argv) return 1; } - bs = calloc(bs_n, sizeof(BlockDriverState *)); - if (!bs) { - error("Out of memory"); - return 1; - } + bs = qemu_mallocz(bs_n * sizeof(BlockDriverState *)); total_sectors = 0; for (bs_i = 0; bs_i < bs_n; bs_i++) { @@ -983,7 +979,7 @@ out: bdrv_delete(bs[bs_i]); } } - free(bs); + qemu_free(bs); if (ret) { return 1; }