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:
parent
7beef70871
commit
178ac3d133
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user