]> git.ipfire.org Git - thirdparty/iptables.git/commit
nft: cmd: Init struct nft_cmd::head early
authorPhil Sutter <phil@nwl.cc>
Tue, 23 Jul 2024 19:31:34 +0000 (21:31 +0200)
committerPhil Sutter <phil@nwl.cc>
Sat, 27 Jul 2024 17:32:57 +0000 (19:32 +0200)
commitdb7fc1862b8bd5e2eea83ed4089fcf35fc01c032
tree2946587ebb2e0739e5c5e0fcea97633a1763b0a7
parentbb2ee075d8a626f2249ef9507927fae155b24093
nft: cmd: Init struct nft_cmd::head early

Calling nft_cmd_free() in error case segfaults otherwise if the to be
freed object is not part of a list yet.

Exposed by commit eab75ed36a4f2 ("nft: Avoid memleak in error path of
nft_cmd_new()"), but belongs to commit a7f1e208cdf9c (and may go well
along with it).

Fixes: a7f1e208cdf9c ("nft: split parsing from netlink commands")
Signed-off-by: Phil Sutter <phil@nwl.cc>
iptables/nft-cmd.c