1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

network: Move virObjectRef during AssignDef processing

Move the virObjectRef in virNetworkObjAssignDefLocked to after
the virHashAddEntry to make it "clearer" why the @ref is being
incremented. Upon return from the ObjNew we will have 1 ref on
the object already, adding it to the hash table requires the
increment.

Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
John Ferlan 2017-07-26 09:43:12 -04:00
parent 7beef70871
commit 178ac3d133

View File

@ -577,10 +577,10 @@ virNetworkObjAssignDefLocked(virNetworkObjListPtr nets,
virUUIDFormat(def->uuid, uuidstr);
if (virHashAddEntry(nets->objs, uuidstr, obj) < 0)
goto cleanup;
virObjectRef(obj);
obj->def = def;
obj->persistent = !(flags & VIR_NETWORK_OBJ_LIST_ADD_LIVE);
virObjectRef(obj);
}
ret = obj;