]> xenbits.xensource.com Git - qemu-xen-4.1-testing.git/commitdiff
Use qemu_mallocz() instead of calloc() in img_convert()
authorJes Sorensen <Jes.Sorensen@redhat.com>
Mon, 6 Dec 2010 14:25:35 +0000 (15:25 +0100)
committerKevin Wolf <kwolf@redhat.com>
Tue, 14 Dec 2010 14:44:21 +0000 (15:44 +0100)
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-img.c

index fa77ac0dbe87f6fb36d9e6a0b1abd62b752826a7..eca99c4a5d972c50ff297c01d6859239c04b3526 100644 (file)
@@ -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;
     }