]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
parser_bison: make sure obj_free releases timeout policies
authorFlorian Westphal <fw@strlen.de>
Tue, 12 Dec 2023 09:44:35 +0000 (10:44 +0100)
committerFlorian Westphal <fw@strlen.de>
Tue, 12 Dec 2023 15:33:18 +0000 (16:33 +0100)
obj_free() won't release them because ->type is still 0 at this
point.

Init this to CT_TIMEOUT.

Signed-off-by: Florian Westphal <fw@strlen.de>
src/parser_bison.y
tests/shell/testcases/bogons/nft-f/ct_timeout_memleak_objfree [new file with mode: 0644]

index 70acfc5754fa232c6f3bf690087b47c81a30e546..d13fb961eaf966a22f6f5882248ec5958473b426 100644 (file)
@@ -2513,6 +2513,7 @@ ct_timeout_block  :       /*empty */
                        {
                                $$ = $<obj>-1;
                                init_list_head(&$$->ct_timeout.timeout_list);
+                               $$->type = NFT_OBJECT_CT_TIMEOUT;
                        }
                        |       ct_timeout_block     common_block
                        |       ct_timeout_block     stmt_separator
diff --git a/tests/shell/testcases/bogons/nft-f/ct_timeout_memleak_objfree b/tests/shell/testcases/bogons/nft-f/ct_timeout_memleak_objfree
new file mode 100644 (file)
index 0000000..28b1a21
--- /dev/null
@@ -0,0 +1,5 @@
+table ip filter {
+       ct timeout cttime {
+               protocol tcp
+               l3proto ip
+               policy = { close : 12s }