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@xxxxxxxxxx> --- 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 037186e..43fc2cf 100644 --- a/src/conf/virnetworkobj.c +++ b/src/conf/virnetworkobj.c @@ -595,10 +595,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; -- 2.9.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list