summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2016-05-19 15:21:14 +0000
committerRoy Marples <roy@marples.name>2016-05-19 15:21:14 +0000
commit796213545e42807094f26dd6dd82abddcd8633ac (patch)
treedbe970974ba29cf5c340d7e89c7f5c1f8f00e3c9
parent6ca5a4e867e564926b5d64667f9c63078fb63ccf (diff)
downloaddhcpcd-796213545e42807094f26dd6dd82abddcd8633ac.tar.xz
Fix compile.
-rw-r--r--if.c9
1 files changed, 4 insertions, 5 deletions
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;
}