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:
Michal Privoznik 2022-08-09 13:37:32 +02:00
parent 42880776d8
commit 3fe52b7818

View File

@ -450,7 +450,7 @@ networkUpdateState(virNetworkObj *obj,
virNetworkDef *def;
virNetworkDriverState *driver = opaque;
g_autoptr(dnsmasqCaps) dnsmasq_caps = networkGetDnsmasqCaps(driver);
virMacMap *macmap;
g_autoptr(virMacMap) macmap = NULL;
g_autofree char *macMapFile = NULL;
VIR_LOCK_GUARD lock = virObjectLockGuard(obj);
@ -476,6 +476,7 @@ networkUpdateState(virNetworkObj *obj,
return -1;
virNetworkObjSetMacMap(obj, macmap);
macmap = NULL;
break;
@ -1938,7 +1939,7 @@ networkStartNetworkVirtual(virNetworkDriverState *driver,
virErrorPtr save_err = NULL;
virNetworkIPDef *ipdef;
virNetDevIPRoute *routedef;
virMacMap *macmap;
g_autoptr(virMacMap) macmap = NULL;
g_autofree char *macMapFile = NULL;
bool dnsmasqStarted = false;
bool devOnline = false;