]> git.ipfire.org Git - thirdparty/libvirt.git/commit
conf: Use virDomainObjListFindBy*Locked for virDomainObjListAdd
authorJohn Ferlan <jferlan@redhat.com>
Fri, 9 Mar 2018 12:37:14 +0000 (07:37 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 3 May 2018 23:09:03 +0000 (19:09 -0400)
commit7ae289203ad87319e3dc8452c587e5f4db79d4dd
tree7150eb461aec8946f3601fe3e8b19843aad64e1a
parentcf5184d1e1896ff221e499617412771982782126
conf: Use virDomainObjListFindBy*Locked for virDomainObjListAdd

Use the FindBy{UUID|Name}Locked helpers which will return a locked
and ref counted object rather than the direct virHashLookup and
virObjectLock of the returned object. We'll need to temporarily
virObjectUnref when we assign a new domain @def, but that will
change shortly when virDomainObjListAddObjLocked returns the
correct reference counted object.

Use the virDomainObjEndAPI in the error path to Unref/Unlock for
the corresponding Unref/Unlock of either the FindBy* return or
the virDomainObjNew since both return a reffed/locked object.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
src/conf/virdomainobjlist.c