summaryrefslogtreecommitdiffhomepage
path: root/libbb/inet_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/inet_common.c')
-rw-r--r--libbb/inet_common.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libbb/inet_common.c b/libbb/inet_common.c
index 207720e96..7208db9ea 100644
--- a/libbb/inet_common.c
+++ b/libbb/inet_common.c
@@ -175,7 +175,8 @@ int FAST_FUNC INET6_resolve(const char *name, struct sockaddr_in6 *sin6)
return -1;
}
memcpy(sin6, ai->ai_addr, sizeof(*sin6));
- freeaddrinfo(ai);
+ if (ai)
+ freeaddrinfo(ai);
return 0;
}