mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-23 06:23:10 +00:00
virsh: Fix ordering of arguments when calling vshCalloc.
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.
This commit is contained in:
parent
fe04138ea0
commit
3cdb3b4e64
@ -17200,8 +17200,8 @@ vshSnapshotListCollect(vshControl *ctl, virDomainPtr dom,
|
|||||||
if (count >= 0) {
|
if (count >= 0) {
|
||||||
/* When mixing --from and --tree, we also want a copy of from
|
/* When mixing --from and --tree, we also want a copy of from
|
||||||
* in the list, but with no parent for that one entry. */
|
* in the list, but with no parent for that one entry. */
|
||||||
snaplist->snaps = vshCalloc(ctl, sizeof(*snaplist->snaps),
|
snaplist->snaps = vshCalloc(ctl, count + (tree && from),
|
||||||
count + (tree && from));
|
sizeof(*snaplist->snaps));
|
||||||
snaplist->nsnaps = count;
|
snaplist->nsnaps = count;
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
snaplist->snaps[i].snap = snaps[i];
|
snaplist->snaps[i].snap = snaps[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user