netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nft] src: memleak in expressions
@ 2019-04-09 21:00 Pablo Neira Ayuso
  0 siblings, 0 replies; only message in thread
From: Pablo Neira Ayuso @ 2019-04-09 21:00 UTC (permalink / raw)
  To: netfilter-devel

Fix memleak in set element and hash expressions destroy path.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 src/expression.c | 1 +
 src/hash.c       | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/src/expression.c b/src/expression.c
index 0edc1d22ffce..eece12e4fd2d 100644
--- a/src/expression.c
+++ b/src/expression.c
@@ -1097,6 +1097,7 @@ static void set_elem_expr_destroy(struct expr *expr)
 {
 	xfree(expr->comment);
 	expr_free(expr->key);
+	stmt_free(expr->stmt);
 }
 
 static void set_elem_expr_clone(struct expr *new, const struct expr *expr)
diff --git a/src/hash.c b/src/hash.c
index 208f4b6b6779..08e09099024e 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -56,6 +56,11 @@ static void hash_expr_clone(struct expr *new, const struct expr *expr)
 	new->hash.type = expr->hash.type;
 }
 
+static void hash_expr_destroy(struct expr *expr)
+{
+	expr_free(expr->hash.expr);
+}
+
 const struct expr_ops hash_expr_ops = {
 	.type		= EXPR_HASH,
 	.name		= "hash",
@@ -63,6 +68,7 @@ const struct expr_ops hash_expr_ops = {
 	.json		= hash_expr_json,
 	.cmp		= hash_expr_cmp,
 	.clone		= hash_expr_clone,
+	.destroy	= hash_expr_destroy,
 };
 
 struct expr *hash_expr_alloc(const struct location *loc,
-- 
2.11.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-04-09 21:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-09 21:00 [PATCH nft] src: memleak in expressions 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).