]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: Fix ordering of arguments when calling vshCalloc.
authorPeter Krempa <pkrempa@redhat.com>
Wed, 4 Jul 2012 10:15:19 +0000 (12:15 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 4 Jul 2012 12:01:37 +0000 (14:01 +0200)
In vshSnapshotListCollect() vshCalloc was called with swapped nmemb and
size argument. This caused division by zero in xalloc_oversized as the
macro doesn't expect size to be zero.

tools/virsh.c

index 53d1825cd75ac60461f5837fec506b6f077e9b86..85b1185887fec15db8601e405c98be109fa04e2f 100644 (file)
@@ -17200,8 +17200,8 @@ vshSnapshotListCollect(vshControl *ctl, virDomainPtr dom,
     if (count >= 0) {
         /* When mixing --from and --tree, we also want a copy of from
          * in the list, but with no parent for that one entry.  */
-        snaplist->snaps = vshCalloc(ctl, sizeof(*snaplist->snaps),
-                                    count + (tree && from));
+        snaplist->snaps = vshCalloc(ctl, count + (tree && from),
+                                    sizeof(*snaplist->snaps));
         snaplist->nsnaps = count;
         for (i = 0; i < count; i++)
             snaplist->snaps[i].snap = snaps[i];