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>
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;