[libvirt] [PATCH] nwfilter: Don't leak @inetaddr

ZhiPeng Lu lu.zhipeng at zte.com.cn
Tue Sep 26 19:37:41 UTC 2017


In learnIPAddressThread()the @inetaddr may be leaked.

Signed-off-by: ZhiPeng Lu <lu.zhipeng at zte.com.cn>
---
 src/nwfilter/nwfilter_learnipaddr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
index cfd92d9..018f20f 100644
--- a/src/nwfilter/nwfilter_learnipaddr.c
+++ b/src/nwfilter/nwfilter_learnipaddr.c
@@ -627,6 +627,7 @@ learnIPAddressThread(void *arg)
                           "cache for interface %s"), inetaddr, req->ifname);
             }
 
+            inetaddr = NULL;
             ret = virNWFilterInstantiateFilterLate(req->driver,
                                                    NULL,
                                                    req->ifname,
@@ -636,7 +637,8 @@ learnIPAddressThread(void *arg)
                                                    req->filtername,
                                                    req->filterparams);
             VIR_DEBUG("Result from applying firewall rules on "
-                      "%s with IP addr %s : %d", req->ifname, inetaddr, ret);
+                      "%s with IP addr %s : %d", req->ifname, NULLSTR(inetaddr), ret);
+            VIR_FREE(inetaddr);
         }
     } else {
         if (showError)
-- 
1.8.3.1




More information about the libvir-list mailing list