提交 b58a6b05 编写于 作者: M Michal Privoznik

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: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NErik Skultety <eskultet@redhat.com>
上级 23024359
......@@ -15563,7 +15563,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
virCapsPtr caps = NULL;
qemuDomainObjPrivatePtr priv;
virDomainSnapshotState state;
VIR_AUTOFREE(virDomainSnapshotDefPtr) def = NULL;
VIR_AUTOUNREF(virDomainSnapshotDefPtr) def = NULL;
virCheckFlags(VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE |
VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册