mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
network: Have virNetworkObjNew lock the returned object
Forces callers to use the virNetworkObjEndAPI properly. Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
26c8fe4990
commit
7beef70871
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user