mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 09:17:52 +03:00
bridge_driver: Use g_autoptr() for virMacMap
Let's annotate virMacMap variables in bridge_driver.c with g_autoptr() so that they are automatically freed upon error. This may look like a needless commit, since there's no memory leak currently, but it simplifies the next commit. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
42880776d8
commit
3fe52b7818
@ -450,7 +450,7 @@ networkUpdateState(virNetworkObj *obj,
|
|||||||
virNetworkDef *def;
|
virNetworkDef *def;
|
||||||
virNetworkDriverState *driver = opaque;
|
virNetworkDriverState *driver = opaque;
|
||||||
g_autoptr(dnsmasqCaps) dnsmasq_caps = networkGetDnsmasqCaps(driver);
|
g_autoptr(dnsmasqCaps) dnsmasq_caps = networkGetDnsmasqCaps(driver);
|
||||||
virMacMap *macmap;
|
g_autoptr(virMacMap) macmap = NULL;
|
||||||
g_autofree char *macMapFile = NULL;
|
g_autofree char *macMapFile = NULL;
|
||||||
VIR_LOCK_GUARD lock = virObjectLockGuard(obj);
|
VIR_LOCK_GUARD lock = virObjectLockGuard(obj);
|
||||||
|
|
||||||
@ -476,6 +476,7 @@ networkUpdateState(virNetworkObj *obj,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
virNetworkObjSetMacMap(obj, macmap);
|
virNetworkObjSetMacMap(obj, macmap);
|
||||||
|
macmap = NULL;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1938,7 +1939,7 @@ networkStartNetworkVirtual(virNetworkDriverState *driver,
|
|||||||
virErrorPtr save_err = NULL;
|
virErrorPtr save_err = NULL;
|
||||||
virNetworkIPDef *ipdef;
|
virNetworkIPDef *ipdef;
|
||||||
virNetDevIPRoute *routedef;
|
virNetDevIPRoute *routedef;
|
||||||
virMacMap *macmap;
|
g_autoptr(virMacMap) macmap = NULL;
|
||||||
g_autofree char *macMapFile = NULL;
|
g_autofree char *macMapFile = NULL;
|
||||||
bool dnsmasqStarted = false;
|
bool dnsmasqStarted = false;
|
||||||
bool devOnline = false;
|
bool devOnline = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user