All of lore.kernel.org
 help / color / mirror / Atom feed
From: Piyush Pangtey <gokuvsvegita@gmail.com>
To: netfilter-devel@vger.kernel.org
Subject: Memory-leak in nft
Date: Tue, 15 Mar 2016 23:53:05 +0530	[thread overview]
Message-ID: <20160315182305.GA4044@fate> (raw)

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>

                 reply	other threads:[~2016-03-15 18:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20160315182305.GA4044@fate \
    --to=gokuvsvegita@gmail.com \
    --cc=netfilter-devel@vger.kernel.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 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.