提交 7beef708 编写于 作者: J John Ferlan

network: Have virNetworkObjNew lock the returned object

Forces callers to use the virNetworkObjEndAPI properly.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
上级 26c8fe49
......@@ -87,6 +87,8 @@ virNetworkObjNew(void)
ignore_value(virBitmapSetBit(obj->classIdMap, 1));
ignore_value(virBitmapSetBit(obj->classIdMap, 2));
virObjectLock(obj);
return obj;
error:
......@@ -572,8 +574,6 @@ virNetworkObjAssignDefLocked(virNetworkObjListPtr nets,
if (!(obj = virNetworkObjNew()))
goto cleanup;
virObjectLock(obj);
virUUIDFormat(def->uuid, uuidstr);
if (virHashAddEntry(nets->objs, uuidstr, obj) < 0)
goto cleanup;
......
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册