From: John Ferlan Date: Wed, 26 Jul 2017 13:43:12 +0000 (-0400) Subject: network: Move virObjectRef during AssignDef processing X-Git-Tag: v3.7.0-rc1~122 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=178ac3d133d97c6d91d9a7c067b5a64c3dfe962e;p=thirdparty%2Flibvirt.git 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 --- diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c index 41a6c33809..d1636bcc1b 100644 --- a/src/conf/virnetworkobj.c +++ b/src/conf/virnetworkobj.c @@ -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;