summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>2013-03-08 19:50:51 (GMT)
committer Denys Vlasenko <vda.linux@googlemail.com>2013-03-15 00:23:48 (GMT)
commit4a600f8777f3fa0f673b47ccc8a0ba9cf6634249 (patch)
tree9f2ac978c6ccb6475be8e0483d2923d114acc98e
parent45dc96c8a6dce3aeea983f6c32572d4cee646b5d (diff)
downloadbusybox-4a600f8777f3fa0f673b47ccc8a0ba9cf6634249.tar.gz
busybox-4a600f8777f3fa0f673b47ccc8a0ba9cf6634249.tar.bz2
traceroute: free some memory allocated by xzalloc()
Signed-off-by: Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/traceroute.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/networking/traceroute.c b/networking/traceroute.c
index 6b7b2eb..0c18d6c 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -805,6 +805,7 @@ common_traceroute_main(int op, char **argv)
char *waittime_str;
char *pausemsecs_str;
char *first_ttl_str;
+ char *dest_str;
#if ENABLE_FEATURE_TRACEROUTE_SOURCE_ROUTE
llist_t *source_route_list = NULL;
int lsrr = 0;
@@ -1059,8 +1060,12 @@ common_traceroute_main(int op, char **argv)
xsetgid(getgid());
xsetuid(getuid());
- printf("traceroute to %s (%s)", argv[0],
- xmalloc_sockaddr2dotted_noport(&dest_lsa->u.sa));
+ dest_str = xmalloc_sockaddr2dotted_noport(&dest_lsa->u.sa);
+ printf("traceroute to %s (%s)", argv[0], dest_str);
+ if (ENABLE_FEATURE_CLEAN_UP) {
+ free(dest_str);
+ }
+
if (op & OPT_SOURCE)
printf(" from %s", source);
printf(", %d hops max, %d byte packets\n", max_ttl, packlen);
@@ -1216,6 +1221,12 @@ common_traceroute_main(int op, char **argv)
}
}
+ if (ENABLE_FEATURE_CLEAN_UP) {
+ free(to);
+ free(lastaddr);
+ free(from_lsa);
+ }
+
return 0;
}