summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Popelka <jpopelka@redhat.com>2012-06-29 10:04:58 +0200
committerJiri Popelka <jpopelka@redhat.com>2012-06-29 17:42:48 +0200
commite8b37a8407f053bfbf378df3bd8d94cf1e71f7b8 (patch)
treeed2f3b305e07a07b0aa3f76ee00b43b6f1a18269
parent992a1def36ca8518f740ee8f23af1cc569ab2fef (diff)
downloadnet-tools-e8b37a8407f053bfbf378df3bd8d94cf1e71f7b8.tar.gz
net-tools-e8b37a8407f053bfbf378df3bd8d94cf1e71f7b8.tar.bz2
net-tools-e8b37a8407f053bfbf378df3bd8d94cf1e71f7b8.zip
netstat memory leak fixed.
valgrind --leak-check=full netstat (x86_64) before: definitely lost: 1,536 bytes in 64 blocks indirectly lost: 479 bytes in 64 blocks ERROR SUMMARY: 1 errors from 1 contexts after: definitely lost: 0 bytes in 0 blocks indirectly lost: 0 bytes in 0 blocks ERROR SUMMARY: 0 errors from 0 contexts
-rw-r--r--lib/inet.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/inet.c b/lib/inet.c
index 55fb795..9777164 100644
--- a/lib/inet.c
+++ b/lib/inet.c
@@ -396,6 +396,9 @@ static int read_services(void)
add2list(&udp_name, item);
} else if (!strcmp(se->s_proto, "raw")) {
add2list(&raw_name, item);
+ } else { /* sctp, ddp, dccp */
+ free(item->name);
+ free(item);
}
}
endservent();