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

ZhiPeng Lu posted 1 patch 6 years, 7 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1506454661-2085-1-git-send-email-lu.zhipeng@zte.com.cn
There is a newer version of this series
src/nwfilter/nwfilter_learnipaddr.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[libvirt] [PATCH] nwfilter: Don't leak @inetaddr
Posted by ZhiPeng Lu 6 years, 7 months ago
In learnIPAddressThread()the @inetaddr may be leaked.

Signed-off-by: ZhiPeng Lu <lu.zhipeng@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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list