[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <loom.20130307T103516-549@post.gmane.org>
Date: Thu, 7 Mar 2013 09:52:22 +0000 (UTC)
From: jb <jb.1234abcd@...il.com>
To: netdev@...r.kernel.org
Subject: [PATCH] iputils: fix memory leaks
Fix memory leaks
Signed-off-by: JB <jb.1234abcd@...il.com>
---
ping.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/ping.c b/ping.c
index c0366cd..04f5596 100644
--- a/ping.c
+++ b/ping.c
@@ -282,10 +282,15 @@ main(int argc, char **argv)
hp = gethostbyname(idn);
if (!hp) {
fprintf(stderr, "ping: unknown host %s\n", target);
+#ifdef USE_IDN
+ free(idn);
+ idn = NULL;
+#endif
exit(2);
}
#ifdef USE_IDN
free(idn);
+ idn = NULL;
#endif
memcpy(&whereto.sin_addr, hp->h_addr, 4);
#ifdef USE_IDN
@@ -301,6 +306,10 @@ main(int argc, char **argv)
hnamebuf[sizeof(hnamebuf) - 1] = 0;
#endif
hostname = hnamebuf;
+#ifdef USE_IDN
+ free(hnamebuf);
+ hnamebuf = NULL;
+#endif
}
if (argc > 1)
route[nroute++] = whereto.sin_addr.s_addr;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists