From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [libnftables PATCH] xml: expr: fix mem leak in the expr parser
Date: Wed, 14 Aug 2013 11:17:56 +0200 [thread overview]
Message-ID: <20130814091756.GA5771@localhost> (raw)
In-Reply-To: <20130812123335.25249.17288.stgit@nfdev.cica.es>
Hi Arturo,
On Mon, Aug 12, 2013 at 02:33:35PM +0200, Arturo Borrero Gonzalez wrote:
> There was several mem leaks as reported by valgrind:
>
> ==23503== 3 bytes in 1 blocks are definitely lost in loss record 1 of 44
> ==23503== at 0x4C28BED: malloc (vg_replace_malloc.c:263)
> ==23503== by 0x56F1B41: strdup (strdup.c:43)
> ==23503== by 0x4E3BE62: nft_rule_expr_exthdr_xml_parse (exthdr.c:212)
> ==23503== by 0x4E3909A: nft_mxml_expr_parse (mxml.c:49)
> ==23503== by 0x4E368CC: nft_rule_parse (rule.c:581)
> ==23503== by 0x401462: main (nft-parsing-test.c:255)
>
> So, once those string are used, do a free.
I have fixed this in a different way. Most callers don't seem to need
the string duplication, therefore, I decided to remove it. We save the
many free invocations that your patch needed. We save some lines of
code.
Regards.
prev parent reply other threads:[~2013-08-14 9:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-12 12:33 [libnftables PATCH] xml: expr: fix mem leak in the expr parser Arturo Borrero Gonzalez
2013-08-14 9:17 ` Pablo Neira Ayuso [this message]
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=20130814091756.GA5771@localhost \
--to=pablo@netfilter.org \
--cc=arturo.borrero.glez@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).