From 178ac3d133d97c6d91d9a7c067b5a64c3dfe962e Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Wed, 26 Jul 2017 09:43:12 -0400 Subject: [PATCH] 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 --- src/conf/virnetworkobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- GitLab