netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [nft PATCH 0/7] some memory leak fixes
@ 2017-07-10 22:32 Eric Leblond
  2017-07-10 22:32 ` [nft PATCH 1/7] src: fix memory leak when listing rules Eric Leblond
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Eric Leblond @ 2017-07-10 22:32 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel


Hi,

Here's a small patchset fixing some memory leaks in nftables. Most
of them have been found using ASAN.

There is still a problem in memory handling due to the max_errors
system that stack errors to avoid an exit on first error. The
consequence is that the bison parser is loosing track of its
internal stacks and can not call the destructors when there
is an error in the command.

If we do set max_errors to 1: 

 diff --git a/src/main.c b/src/main.c
 index 7fbf00a..183bd0e 100644
 --- a/src/main.c
 +++ b/src/main.c
 @@ -29,7 +29,7 @@
  #include <cli.h>
  
  static struct nft_ctx nft;
 -unsigned int max_errors = 10;
 +unsigned int max_errors = 1;
  #ifdef DEBUG
  unsigned int debug_level;
  #endif

Then there is no more memory leak in case of an invalid command
but we loose the display of multiple errors.

A possibleway to fix that would be to be able to set max_errors
via a configuration function. It would be set to 1 by default.
So users of libnftables will not experiment memleak but we
could keep the same behavior in nft by setting it to 10
explicetely.

BR,
--
Eric


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-07-17 15:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-10 22:32 [nft PATCH 0/7] some memory leak fixes Eric Leblond
2017-07-10 22:32 ` [nft PATCH 1/7] src: fix memory leak when listing rules Eric Leblond
2017-07-10 22:32 ` [nft PATCH 2/7] parser: fix memory leak in set creation Eric Leblond
2017-07-10 22:32 ` [nft PATCH 3/7] parser: fix bison warnings Eric Leblond
2017-07-10 22:32 ` [nft PATCH 4/7] parser: error if needed at EOF Eric Leblond
2017-07-10 22:32 ` [nft PATCH 5/7] evaluate: fix build with clang Eric Leblond
2017-07-10 22:32 ` [nft PATCH 6/7] scanner: free filename when destroying scanner Eric Leblond
2017-07-10 22:32 ` [nft PATCH 7/7] cli: fix heap buffer overflow Eric Leblond
2017-07-17 15:24 ` [nft PATCH 0/7] some memory leak fixes Pablo Neira Ayuso

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).