diff options
author | Vitaly Magerya | 2011-03-22 20:14:26 +0100 |
---|---|---|
committer | Denys Vlasenko | 2011-03-22 20:14:26 +0100 |
commit | 7f4b769c42f3773ff2e2e749547291dcb7e85d01 (patch) | |
tree | 33680f1d1a6d182c2d78dd2158ee696528fea920 /libbb/inet_common.c | |
parent | cf9074b54bfb5a325ce59127b7afe1e892223a1c (diff) | |
download | busybox-7f4b769c42f3773ff2e2e749547291dcb7e85d01.zip busybox-7f4b769c42f3773ff2e2e749547291dcb7e85d01.tar.gz |
don't call freeaddinfo(NULL)
Signed-off-by: Vitaly Magerya <vmagerya@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/inet_common.c')
-rw-r--r-- | libbb/inet_common.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libbb/inet_common.c b/libbb/inet_common.c index 6f585eb..207720e 100644 --- a/libbb/inet_common.c +++ b/libbb/inet_common.c @@ -164,17 +164,17 @@ char* FAST_FUNC INET_rresolve(struct sockaddr_in *s_in, int numeric, uint32_t ne int FAST_FUNC INET6_resolve(const char *name, struct sockaddr_in6 *sin6) { - struct addrinfo req, *ai; + struct addrinfo req, *ai = NULL; int s; - memset(&req, '\0', sizeof req); + memset(&req, 0, sizeof(req)); req.ai_family = AF_INET6; s = getaddrinfo(name, NULL, &req, &ai); - if (s) { + if (s != 0) { bb_error_msg("getaddrinfo: %s: %d", name, s); return -1; } - memcpy(sin6, ai->ai_addr, sizeof(struct sockaddr_in6)); + memcpy(sin6, ai->ai_addr, sizeof(*sin6)); freeaddrinfo(ai); return 0; } @@ -209,9 +209,11 @@ char* FAST_FUNC INET6_rresolve(struct sockaddr_in6 *sin6, int numeric) return xstrdup("*"); } - s = getnameinfo((struct sockaddr *) sin6, sizeof(struct sockaddr_in6), - name, sizeof(name), NULL, 0, 0); - if (s) { + s = getnameinfo((struct sockaddr *) sin6, sizeof(*sin6), + name, sizeof(name), + /*serv,servlen:*/ NULL, 0, + 0); + if (s != 0) { bb_error_msg("getnameinfo failed"); return NULL; } |