[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 2/2] networkStartNetworkVirtual: Don't leak macmap object



When starting network a macmap object is created (which stores
MAC -> domain name mappings). However, if something goes wrong
(e.g. virNetDevIPCheckIPv6Forwarding() fails) then the object is
leaked.

Signed-off-by: Michal Privoznik <mprivozn redhat com>
---
 src/network/bridge_driver.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index f92cc61e47..588b0d147d 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -2453,6 +2453,7 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
         goto err1;
 
     virNetworkObjSetMacMap(obj, macmap);
+    macmap = NULL;
 
     /* Set bridge options */
 
@@ -2590,6 +2591,7 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
         ignore_value(virNetDevTapDelete(macTapIfName, NULL));
         VIR_FREE(macTapIfName);
     }
+    virNetworkObjUnrefMacMap(obj);
     VIR_FREE(macMapFile);
 
  err0:
-- 
2.16.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]