* [PATCH nftables] netlink_delinearize: stmt and expr error path memleaks
@ 2021-07-12 17:03 Pablo Neira Ayuso
0 siblings, 0 replies; only message in thread
From: Pablo Neira Ayuso @ 2021-07-12 17:03 UTC (permalink / raw)
To: netfilter-devel
Use stmt_free() and expr_free() to release these objects.
Fixes: 671851617c8d ("netlink_delinearize: Fix resource leaks")
Fixes: 3a8640672978 ("src: hash: support of symmetric hash")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
src/netlink_delinearize.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c
index 744af3b064d7..2723515df47a 100644
--- a/src/netlink_delinearize.c
+++ b/src/netlink_delinearize.c
@@ -637,7 +637,7 @@ static void netlink_parse_exthdr(struct netlink_parse_ctx *ctx,
sreg = netlink_parse_register(nle, NFTNL_EXPR_EXTHDR_SREG);
val = netlink_get_register(ctx, loc, sreg);
if (val == NULL) {
- xfree(expr);
+ expr_free(expr);
return netlink_error(ctx, loc,
"exthdr statement has no expression");
}
@@ -679,7 +679,7 @@ static void netlink_parse_hash(struct netlink_parse_ctx *ctx,
len = nftnl_expr_get_u32(nle,
NFTNL_EXPR_HASH_LEN) * BITS_PER_BYTE;
if (hexpr->len < len) {
- xfree(hexpr);
+ expr_free(hexpr);
hexpr = netlink_parse_concat_expr(ctx, loc, sreg, len);
if (hexpr == NULL)
goto out_err;
@@ -691,7 +691,7 @@ static void netlink_parse_hash(struct netlink_parse_ctx *ctx,
netlink_set_register(ctx, dreg, expr);
return;
out_err:
- xfree(expr);
+ expr_free(expr);
}
static void netlink_parse_fib(struct netlink_parse_ctx *ctx,
@@ -1196,7 +1196,7 @@ static void netlink_parse_nat(struct netlink_parse_ctx *ctx,
ctx->stmt = stmt;
return;
out_err:
- xfree(stmt);
+ stmt_free(stmt);
}
static void netlink_parse_synproxy(struct netlink_parse_ctx *ctx,
@@ -1260,7 +1260,7 @@ static void netlink_parse_tproxy(struct netlink_parse_ctx *ctx,
ctx->stmt = stmt;
return;
err:
- xfree(stmt);
+ stmt_free(stmt);
}
static void netlink_parse_masq(struct netlink_parse_ctx *ctx,
@@ -1307,7 +1307,7 @@ static void netlink_parse_masq(struct netlink_parse_ctx *ctx,
ctx->stmt = stmt;
return;
out_err:
- xfree(stmt);
+ stmt_free(stmt);
}
static void netlink_parse_redir(struct netlink_parse_ctx *ctx,
@@ -1358,7 +1358,7 @@ static void netlink_parse_redir(struct netlink_parse_ctx *ctx,
ctx->stmt = stmt;
return;
out_err:
- xfree(stmt);
+ stmt_free(stmt);
}
static void netlink_parse_dup(struct netlink_parse_ctx *ctx,
@@ -1411,7 +1411,7 @@ static void netlink_parse_dup(struct netlink_parse_ctx *ctx,
ctx->stmt = stmt;
return;
out_err:
- xfree(stmt);
+ stmt_free(stmt);
}
static void netlink_parse_fwd(struct netlink_parse_ctx *ctx,
@@ -1473,7 +1473,7 @@ static void netlink_parse_fwd(struct netlink_parse_ctx *ctx,
ctx->stmt = stmt;
return;
out_err:
- xfree(stmt);
+ stmt_free(stmt);
}
static void netlink_parse_queue(struct netlink_parse_ctx *ctx,
@@ -1636,7 +1636,7 @@ out_err:
list_for_each_entry_safe(dstmt, next, &dynset_parse_ctx.stmt_list, list)
stmt_free(dstmt);
- xfree(expr);
+ expr_free(expr);
}
static void netlink_parse_objref(struct netlink_parse_ctx *ctx,
--
2.20.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-12 17:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-12 17:03 [PATCH nftables] netlink_delinearize: stmt and expr error path memleaks 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).