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

In aiforaf() (which exists only when building for BSD) the @ipAddr may be leaked. Signed-off-by: Michal Privoznik <mprivozn@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

On 09/21/2017 11:48 AM, Michal Privoznik wrote:
In aiforaf() (which exists only when building for BSD) the @ipAddr may be leaked.
Signed-off-by: Michal Privoznik <mprivozn@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++; } }
ACK.
participants (2)
-
Laine Stump
-
Michal Privoznik