summaryrefslogtreecommitdiff
path: root/core/iputils/iputils-20121114-free-unintialized.patch
blob: 524b640ea9b80cb5ef37bfd86c75389d9b1a24f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From: Jan Synacek <jsynacek@redhat.com>
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 <yoshfuji@linux-ipv6.org>
---

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) {