diff --git a/ping.c b/ping.c index 733477f..d9a3f5d 100644 --- a/ping.c +++ b/ping.c @@ -589,8 +589,10 @@ int ping4_run(int argc, char **argv, struct addrinfo *ai, socket_st *sock) strncpy(hnamebuf, ai->ai_canonname, sizeof hnamebuf - 1); hostname = hnamebuf; - if (result) + if (result) { freeaddrinfo(result); + ai = NULL; + } } if (argc > 1) route[nroute++] = whereto.sin_addr.s_addr;