From: Jan Synacek Date: Wed, 14 Nov 2012 12:57:16 +0000 (+0100) Subject: ping: Don't free an unintialized value. X-Git-Url: http://www.linux-ipv6.org/gitweb/gitweb.cgi?p=gitroot%2Fiputils.git;a=commitdiff_plain;h=44c6c9a8d3f3fc65fc52e5957bfd4cc4634f0006 ping: Don't free an unintialized value. Signed-off-by: YOSHIFUJI Hideaki --- diff --git a/ping.c b/ping.c index fe9ff8a..9de3d08 100644 --- a/ping.c +++ b/ping.c @@ -122,7 +122,7 @@ main(int argc, char **argv) u_char *packet; char *target; #ifdef USE_IDN - char *hnamebuf; + char *hnamebuf = NULL; #else char hnamebuf[MAX_HOSTNAMELEN]; #endif @@ -263,8 +263,10 @@ main(int argc, char **argv) #ifdef USE_IDN int rc; - free(hnamebuf); - hnamebuf = NULL; + if (hnamebuf) { + free(hnamebuf); + hnamebuf = NULL; + } rc = idna_to_ascii_lz(target, &idn, 0); if (rc != IDNA_SUCCESS) {