[nftables] Fix some memory leaks
Patrick McHardy
netfilter-cvslog-bounces at lists.netfilter.org
Fri Mar 20 17:56:43 CET 2009
Gitweb: http://git.netfilter.org/cgi-bin/gitweb.cgi?p=nftables.git;a=commit;h=fc42681eb5872c1ddc3008b35c7c662a46efe8bb
commit fc42681eb5872c1ddc3008b35c7c662a46efe8bb
Author: Patrick McHardy <kaber at trash.net>
AuthorDate: Fri Mar 20 17:42:55 2009 +0100
Commit: Patrick McHardy <kaber at trash.net>
CommitDate: Fri Mar 20 17:42:55 2009 +0100
Fix some memory leaks
Free nested chain handles and command structures when done.
Signed-off-by: Patrick McHardy <kaber at trash.net>
via fc42681eb5872c1ddc3008b35c7c662a46efe8bb (commit)
from 7feffa0ed35e4125f272edded092b890234a794b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit fc42681eb5872c1ddc3008b35c7c662a46efe8bb
Author: Patrick McHardy <kaber at trash.net>
Date: Fri Mar 20 17:42:55 2009 +0100
Fix some memory leaks
Free nested chain handles and command structures when done.
Signed-off-by: Patrick McHardy <kaber at trash.net>
-----------------------------------------------------------------------
src/main.c | 6 ++++--
src/parser.y | 1 +
2 files changed, 5 insertions(+), 2 deletions(-)
Free nested chain handles and command structures when done.
Signed-off-by: Patrick McHardy <kaber at trash.net>
diff --git a/src/main.c b/src/main.c
index 00f594f..3daa294 100644
--- a/src/main.c
+++ b/src/main.c
@@ -183,14 +183,16 @@ int main(int argc, char * const *argv)
{
struct netlink_ctx ctx;
- struct cmd *cmd;
+ struct cmd *cmd, *next;
- list_for_each_entry(cmd, &state.cmds, list) {
+ list_for_each_entry_safe(cmd, next, &state.cmds, list) {
memset(&ctx, 0, sizeof(ctx));
ctx.msgs = &msgs;
init_list_head(&ctx.list);
if (do_command(&ctx, cmd) < 0)
goto out;
+ list_del(&cmd->list);
+ cmd_free(cmd);
}
}
out:
diff --git a/src/parser.y b/src/parser.y
index d9da115..90f9052 100644
--- a/src/parser.y
+++ b/src/parser.y
@@ -576,6 +576,7 @@ table_line : CHAIN chain_identifier chain_block_alloc
'{' chain_block '}'
{
handle_merge(&$3->handle, &$2);
+ handle_free(&$2);
close_scope(state);
$$ = $3;
}
More information about the netfilter-cvslog
mailing list