[libvirt] [PATCH v2 5.3/16] network: Unconditionally initialize macmap when stopping virtual network

John Ferlan jferlan at redhat.com
Wed Jul 26 11:50:09 UTC 2017


Since we can only ever have one reference to obj->macmap, rather
than only clearing obj->macmap during virNetworkObjUnrefMacMap
(e.g. virtual network from networkShutdownNetwork), let's just
unconditionally clear the obj->macmap to ensure that some future
change that created it's own reference to obj->macmap wouldn't
have that reference disappear if virNetworkObjDispose got called.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/conf/virnetworkobj.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c
index 5578ac3..bb7225c 100644
--- a/src/conf/virnetworkobj.c
+++ b/src/conf/virnetworkobj.c
@@ -125,8 +125,8 @@ virNetworkObjSetMacMap(virNetworkObjPtr obj,
 void
 virNetworkObjUnrefMacMap(virNetworkObjPtr obj)
 {
-    if (!virObjectUnref(obj->macmap))
-        obj->macmap = NULL;
+    virObjectUnref(obj->macmap);
+    obj->macmap = NULL;
 }
 
 
-- 
2.9.4




More information about the libvir-list mailing list