[libvirt] [PATCH] nss: Don't leak @ipAddr

Michal Privoznik mprivozn at redhat.com
Thu Sep 21 15:48:43 UTC 2017


In aiforaf() (which exists only when building for BSD) the
@ipAddr may be leaked.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 tools/nss/libvirt_nss.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c
index 9904026da..da4bf79a4 100644
--- a/tools/nss/libvirt_nss.c
+++ b/tools/nss/libvirt_nss.c
@@ -643,6 +643,7 @@ aiforaf(const char *name, int af, struct addrinfo *pai, struct addrinfo **aip)
         hints.ai_family = af;
 
         if (getaddrinfo(ipAddr, NULL, &hints, &res0)) {
+            VIR_FREE(ipAaddr);
             addrList++;
             continue;
         }
@@ -654,6 +655,7 @@ aiforaf(const char *name, int af, struct addrinfo *pai, struct addrinfo **aip)
         while ((*aip)->ai_next)
            *aip = (*aip)->ai_next;
 
+        VIR_FREE(ipAaddr);
         addrList++;
     }
 }
-- 
2.13.5




More information about the libvir-list mailing list