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>
int ret;
char *fullpath;
virDomainSnapshotDefPtr def = NULL;
+ virDomainSnapshotObjPtr snap = NULL;
char ebuf[1024];
virDomainObjLock(vm);
continue;
}
- virDomainSnapshotAssignDef(&vm->snapshots, def);
+ snap = virDomainSnapshotAssignDef(&vm->snapshots, def);
+ if (snap == NULL) {
+ virDomainSnapshotDefFree(def);
+ }
VIR_FREE(fullpath);
VIR_FREE(xmlStr);