From f30e5fe55f252558f6b78c436595051b0506b8c6 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Wed, 16 Jan 2019 13:54:13 +0100 Subject: mnl: name is ignored when deleting a table nlt is reallocated, leaking first allocation and also removing the table name/handle that was set on nlt object. Add a test case for this as well, the batch is supposed to fail when trying to delete a non-existant table, rather than wiping all tables in the same address family. Fixes: 12c362e2214a0 ("mnl: remove alloc_nftnl_table()") Reported-by: Mikhail Morfikov Signed-off-by: Florian Westphal --- src/mnl.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/mnl.c') diff --git a/src/mnl.c b/src/mnl.c index c3d16774..dde232c7 100644 --- a/src/mnl.c +++ b/src/mnl.c @@ -664,10 +664,6 @@ int mnl_nft_table_del(struct netlink_ctx *ctx, const struct cmd *cmd) nftnl_table_set_u64(nlt, NFTNL_TABLE_HANDLE, cmd->handle.handle.id); - nlt = nftnl_table_alloc(); - if (nlt == NULL) - memory_allocation_error(); - nlh = nftnl_nlmsg_build_hdr(nftnl_batch_buffer(ctx->batch), NFT_MSG_DELTABLE, cmd->handle.family, -- cgit v1.2.3