[hackers] [slstatus] ip: fixed memory leak || Tobias Tschinkowitz

From: <git_AT_suckless.org>
Date: Sun, 20 May 2018 22:07:09 +0200 (CEST)

commit 1cd8a7b5109311e03fe9de2372c7adc483445db7
Author: Tobias Tschinkowitz <he4d_AT_posteo.de>
AuthorDate: Sun May 20 15:53:48 2018 +0200
Commit: Aaron Marcher <me_AT_drkhsh.at>
CommitDate: Sun May 20 22:06:54 2018 +0200

    ip: fixed memory leak
    
    free the interface list before returning from the function

diff --git a/components/ip.c b/components/ip.c
index 0b6293e..468dc84 100644
--- a/components/ip.c
+++ b/components/ip.c
_AT_@ -31,6 +31,7 @@ ip(const char *iface, unsigned short sa_family)
                                 host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
                 if (!strcmp(ifa->ifa_name, iface) &&
                     (ifa->ifa_addr->sa_family == sa_family)) {
+ freeifaddrs(ifaddr);
                         if (s != 0) {
                                 warn("getnameinfo: %s", gai_strerror(s));
                                 return NULL;
Received on Sun May 20 2018 - 22:07:09 CEST

This archive was generated by hypermail 2.3.0 : Sun May 20 2018 - 22:12:24 CEST