mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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, 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,
|
|||||||
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
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user