Forces callers to use the virNetworkObjEndAPI properly.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/conf/virnetworkobj.c | 4 ++--
tests/networkxml2conftest.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c
index edea6f5..037186e 100644
--- a/src/conf/virnetworkobj.c
+++ b/src/conf/virnetworkobj.c
@@ -87,6 +87,8 @@ virNetworkObjNew(void)
ignore_value(virBitmapSetBit(obj->classIdMap, 1));
ignore_value(virBitmapSetBit(obj->classIdMap, 2));
+ virObjectLock(obj);
+
return obj;
error:
@@ -590,8 +592,6 @@ virNetworkObjAssignDefLocked(virNetworkObjListPtr nets,
if (!(obj = virNetworkObjNew()))
goto cleanup;
- virObjectLock(obj);
-
virUUIDFormat(def->uuid, uuidstr);
if (virHashAddEntry(nets->objs, uuidstr, obj) < 0)
goto cleanup;
diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c
index 6841810..4251a22 100644
--- a/tests/networkxml2conftest.c
+++ b/tests/networkxml2conftest.c
@@ -67,7 +67,7 @@ testCompareXMLToConfFiles(const char *inxml, const char *outconf,
dnsmasqCapsPtr
VIR_FREE(actual);
VIR_FREE(pidfile);
virCommandFree(cmd);
- virObjectUnref(obj);
+ virNetworkObjEndAPI(&obj);
dnsmasqContextFree(dctx);
return ret;
}
--
2.9.4