From: Roy Marples Date: Thu, 19 May 2016 15:21:14 +0000 (+0000) Subject: Fix compile. X-Git-Tag: v6.11.1~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=796213545e42807094f26dd6dd82abddcd8633ac;p=thirdparty%2Fdhcpcd.git Fix compile. --- diff --git a/if.c b/if.c index 67f04043..e5f78b35 100644 --- 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; }