All of lore.kernel.org
 help / color / mirror / Atom feed
* Memory-leak in nft
@ 2016-03-15 18:23 Piyush Pangtey
  0 siblings, 0 replies; only message in thread
From: Piyush Pangtey @ 2016-03-15 18:23 UTC (permalink / raw)
  To: netfilter-devel

There is still some memory-leak in nft which is due to no matching free for
xstrdup in scanner.l:580.
In main.c, argv is passed as a const, and in main.c:270 filename points to this
const location (by optarg).
So it would be safe to remove xstrdup from scanner.l:580.

$ sudo valgrind --leak-check=full nft -f ~/backup.nft

==4075== 22 bytes in 1 blocks are definitely lost in loss record 1 of 3
==4075==    at 0x4C2AB80: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4075==    by 0x57A3839: strdup (strdup.c:42)
==4075==    by 0x41C0BD: xstrdup (utils.c:64)
==4075==    by 0x41EFA1: scanner_push_file (scanner.l:581)
==4075==    by 0x426C88: scanner_read_file (scanner.l:601)
==4075==    by 0x406225: main (main.c:347)
==4075== 
==4075== LEAK SUMMARY:
==4075==    definitely lost: 22 bytes in 1 blocks
==4075==    indirectly lost: 0 bytes in 0 blocks
==4075==      possibly lost: 0 bytes in 0 blocks
==4075==    still reachable: 832 bytes in 2 blocks
==4075==         suppressed: 0 bytes in 0 blocks

-- 

With regards,
Piyush Pangtey <gokuvsvegita@gmail.com>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-03-15 18:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-15 18:23 Memory-leak in nft Piyush Pangtey

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.