]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix compile.
authorRoy Marples <roy@marples.name>
Thu, 19 May 2016 15:21:14 +0000 (15:21 +0000)
committerRoy Marples <roy@marples.name>
Thu, 19 May 2016 15:21:14 +0000 (15:21 +0000)
if.c

diff --git a/if.c b/if.c
index 67f040430366d35c8493dc035b9392d0bb1a30d9..e5f78b354ec9783ffe3d95be3e648901c62e1acf 100644 (file)
--- a/if.c
+++ b/if.c
@@ -270,12 +270,11 @@ if_discover(struct dhcpcd_ctx *ctx, int argc, char * const *argv)
        const struct sockaddr_ll *sll;
 #endif
 
-       if (if_getifaddrs(&ifaddrs) == -1)
+       if (getifaddrs(&ifaddrs) == -1)
                return NULL;
 
-       ifs = malloc(sizeof(*ifs));
-       if (ifs == NULL)
-               return NULL;
+       if ((ifs = malloc(sizeof(*ifs))) == NULL)
+               goto failed;
        TAILQ_INIT(ifs);
 
        for (ifa = ifaddrs; ifa; ifa = ifa->ifa_next) {
@@ -550,8 +549,8 @@ if_discover(struct dhcpcd_ctx *ctx, int argc, char * const *argv)
        }
 
        if_learnaddrs(ctx, ifs, ifaddrs);
+failed:
        freeifaddrs(ifaddrs);
-
        return ifs;
 }