提交 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) ...@@ -87,6 +87,8 @@ virNetworkObjNew(void)
ignore_value(virBitmapSetBit(obj->classIdMap, 1)); ignore_value(virBitmapSetBit(obj->classIdMap, 1));
ignore_value(virBitmapSetBit(obj->classIdMap, 2)); ignore_value(virBitmapSetBit(obj->classIdMap, 2));
virObjectLock(obj);
return obj; return obj;
error: error:
...@@ -572,8 +574,6 @@ virNetworkObjAssignDefLocked(virNetworkObjListPtr nets, ...@@ -572,8 +574,6 @@ virNetworkObjAssignDefLocked(virNetworkObjListPtr nets,
if (!(obj = virNetworkObjNew())) if (!(obj = virNetworkObjNew()))
goto cleanup; goto cleanup;
virObjectLock(obj);
virUUIDFormat(def->uuid, uuidstr); virUUIDFormat(def->uuid, uuidstr);
if (virHashAddEntry(nets->objs, uuidstr, obj) < 0) if (virHashAddEntry(nets->objs, uuidstr, obj) < 0)
goto cleanup; goto cleanup;
......
...@@ -67,7 +67,7 @@ testCompareXMLToConfFiles(const char *inxml, const char *outconf, dnsmasqCapsPtr ...@@ -67,7 +67,7 @@ testCompareXMLToConfFiles(const char *inxml, const char *outconf, dnsmasqCapsPtr
VIR_FREE(actual); VIR_FREE(actual);
VIR_FREE(pidfile); VIR_FREE(pidfile);
virCommandFree(cmd); virCommandFree(cmd);
virObjectUnref(obj); virNetworkObjEndAPI(&obj);
dnsmasqContextFree(dctx); dnsmasqContextFree(dctx);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册