diff --git a/src/fping.c b/src/fping.c index e44f8d8..29901c9 100644 --- a/src/fping.c +++ b/src/fping.c @@ -1282,6 +1282,7 @@ void add_cidr(char *addr) exit(1); } net_addr = ntohl(((struct sockaddr_in *)addr_res->ai_addr)->sin_addr.s_addr); + freeaddrinfo(addr_res); /* check mask */ if (mask < 1 || mask > 32) { @@ -1310,8 +1311,6 @@ void add_cidr(char *addr) inet_ntop(AF_INET, &in_addr_tmp, buffer, sizeof(buffer)); add_name(buffer); } - - freeaddrinfo(addr_res); } void add_range(char *start, char *end) @@ -1355,6 +1354,7 @@ void add_range(char *start, char *end) end_long = ntohl(((struct sockaddr_in *)addr_res->ai_addr)->sin_addr.s_addr); freeaddrinfo(addr_res); + /* check if generator limit is exceeded */ if (end_long > start_long + MAX_GENERATE) { fprintf(stderr, "%s: -g parameter generates too many addresses\n", prog); exit(1);