]> git.ipfire.org Git - thirdparty/libvirt.git/commit
snapshot: don't leak resources on qemu snapshot failure
authorEric Blake <eblake@redhat.com>
Fri, 12 Aug 2011 20:45:39 +0000 (14:45 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 25 Aug 2011 20:01:36 +0000 (14:01 -0600)
commit861dc84bb5fdb34dad6cdb7482df26b82588c6b1
tree3a6ab7dd2f6091282e14c41bdf881fae3c23a439
parent5495e45e70d10508a5a442114c0b8aa67d8bf807
snapshot: don't leak resources on qemu snapshot failure

https://bugzilla.redhat.com/show_bug.cgi?id=727709
mentions that if qemu fails to create the snapshot (such as what
happens on Fedora 15 qemu, which has qmp but where savevm is only
in hmp, and where libvirt is old enough to not try the hmp fallback),
then 'virsh snapshot-list dom' will show a garbage snapshot entry,
and the libvirt internal directory for storing snapshot metadata
will have a bogus file.

This fixes the fallout bug of polluting the snapshot-list with
garbage on failure (the root cause of the F15 bug of not having
fallback to hmp has already been fixed in newer libvirt releases).

* src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML): Allocate
memory before making snapshot, and cleanup on failure.  Don't
dereference NULL if transient domain exited during snapshot creation.
src/qemu/qemu_driver.c