mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
Fix memory leak while scanning snapshots
If a snapshot with the name already exists, virDomainSnapshotAssignDef() just returns NULL, in which case the snapshot definition is leaked. Currently this leak is not a big problem, since qemuDomainSnapshotLoad() is only called once during initial startup of libvirtd. Signed-off-by: Philipp Hahn <hahn@univention.de>
This commit is contained in:
parent
e6cdb431bd
commit
839a5295ef
@ -293,6 +293,7 @@ static void qemuDomainSnapshotLoad(void *payload,
|
||||
int ret;
|
||||
char *fullpath;
|
||||
virDomainSnapshotDefPtr def = NULL;
|
||||
virDomainSnapshotObjPtr snap = NULL;
|
||||
char ebuf[1024];
|
||||
|
||||
virDomainObjLock(vm);
|
||||
@ -344,7 +345,10 @@ static void qemuDomainSnapshotLoad(void *payload,
|
||||
continue;
|
||||
}
|
||||
|
||||
virDomainSnapshotAssignDef(&vm->snapshots, def);
|
||||
snap = virDomainSnapshotAssignDef(&vm->snapshots, def);
|
||||
if (snap == NULL) {
|
||||
virDomainSnapshotDefFree(def);
|
||||
}
|
||||
|
||||
VIR_FREE(fullpath);
|
||||
VIR_FREE(xmlStr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user