]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemuDomainSnapshotCreateXML: Don't leak parsed snapshot definition
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 14 May 2019 13:43:06 +0000 (15:43 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 14 May 2019 14:42:59 +0000 (16:42 +0200)
commitb58a6b050e1ba6bb96a7adae71dbdacce7bb1582
tree13d29f933a202ed78592a0b1e5a07e2b541e939a
parent230243594eccce7b4e66e9047e5be9a52fee312c
qemuDomainSnapshotCreateXML: Don't leak parsed snapshot definition

This function gets snapshot XML (provided by used) as an
argument. It parses it into a local variable @def and then sets
some more members (e.g. it creates a copy of live domain XML).
Then it proceeds to checking if snapshot XML is valid (e.g. it
contains as many disks as currently in the domain). If this fails
then the control jumps to endjob label and subsequently return
from the function. This is where AUTOFREE function for @def is
ran. Well, because the code says to run plain VIR_FREE() we leak
some memory because @def is actually an object and therefore
it should have been declared as AUTOUNREF.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
src/qemu/qemu_driver.c