[libvirt] [PATCH v2] virsh: Fix segfault of snapshot-list

'snaps' is used after free()'ed. --- tools/virsh-snapshot.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 6dd8bf2..fc6c5b3 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -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); } } -- 1.7.7.6

On 10/22/2012 08:28 AM, Osier Yang wrote:
'snaps' is used after free()'ed. --- tools/virsh-snapshot.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 6dd8bf2..fc6c5b3 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -866,7 +866,7 @@ vshSnapshotListCollect(vshControl *ctl, virDomainPtr dom, goto cleanup; } if (from) { - snaps[snaplist->nsnaps++] = from; + snaplist->snaps[snaplist->nsnaps++].snap = from;
ACK. Thanks for cleaning up my mess. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 2012年10月22日 22:46, Eric Blake wrote:
On 10/22/2012 08:28 AM, Osier Yang wrote:
'snaps' is used after free()'ed. --- tools/virsh-snapshot.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 6dd8bf2..fc6c5b3 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -866,7 +866,7 @@ vshSnapshotListCollect(vshControl *ctl, virDomainPtr dom, goto cleanup; } if (from) { - snaps[snaplist->nsnaps++] = from; + snaplist->snaps[snaplist->nsnaps++].snap = from;
ACK. Thanks for cleaning up my mess.
Pushed, thanks.
participants (2)
-
Eric Blake
-
Osier Yang