virsh: Fix segfault of snapshot-list

'snaps' is used after free()'ed.
(cherry picked from commit e0ad466983)
This commit is contained in:
Osier Yang 2012-10-22 22:28:59 +08:00 committed by Cole Robinson
parent 6bae2c413d
commit 3d12463644

View File

@ -866,7 +866,7 @@ vshSnapshotListCollect(vshControl *ctl, virDomainPtr dom,
goto cleanup;
}
if (from) {
snaps[snaplist->nsnaps++] = from;
snaplist->snaps[snaplist->nsnaps++].snap = from;
virDomainSnapshotRef(from);
}
}