From: Jan Synacek <jsynacek@redhat.com>
To: yoshfuji@linux-ipv6.org
Cc: netdev@vger.kernel.org, Jan Synacek <jsynacek@redhat.com>
Subject: [PATCH 2/2] ping: Don't free an unintialized value.
Date: Wed, 14 Nov 2012 13:57:16 +0100 [thread overview]
Message-ID: <1352897836-17603-3-git-send-email-jsynacek@redhat.com> (raw)
In-Reply-To: <1352897836-17603-1-git-send-email-jsynacek@redhat.com>
---
ping.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
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) {
--
1.7.11.7
next prev parent reply other threads:[~2012-11-14 12:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-14 12:57 [PATCH 0/2] iputils: minor fixes Jan Synacek
2012-11-14 12:57 ` [PATCH 1/2] ping,ping6: Add newline to error message Jan Synacek
2012-11-14 12:57 ` Jan Synacek [this message]
2012-11-14 15:23 ` [PATCH 0/2] iputils: minor fixes YOSHIFUJI Hideaki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1352897836-17603-3-git-send-email-jsynacek@redhat.com \
--to=jsynacek@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).