Because of past limitation of virDomainObjListAddObjLocked() we had to set vm->def even before the object was on the domains list. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/conf/virdomainobjlist.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/conf/virdomainobjlist.c b/src/conf/virdomainobjlist.c index 28cccd0035..1086aec421 100644 --- a/src/conf/virdomainobjlist.c +++ b/src/conf/virdomainobjlist.c @@ -337,12 +337,11 @@ virDomainObjListAddLocked(virDomainObjListPtr doms, if (!(vm = virDomainObjNew(xmlopt))) goto error; + + if (virDomainObjListAddObjLocked(doms, vm, def->uuid, def->name) < 0) + goto error; + vm->def = def; - - if (virDomainObjListAddObjLocked(doms, vm, def->uuid, def->name) < 0) { - vm->def = NULL; - goto error; - } } return vm; -- 2.21.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list