[PATCH nft] segtree: memleak in get_set_decompose()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Release set content on error. Moreover, release input set content in
case we finally manage to decompose it.

Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
---
 src/segtree.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/segtree.c b/src/segtree.c
index 0d53c83fd837..dc2554b72acf 100644
--- a/src/segtree.c
+++ b/src/segtree.c
@@ -727,6 +727,7 @@ int get_set_decompose(struct table *table, struct set *set)
 			range = get_set_interval_find(table, set->handle.set.name,
 						    left, i);
 			if (!range) {
+				expr_free(new_init);
 				errno = ENOENT;
 				return -1;
 			}
@@ -755,6 +756,7 @@ int get_set_decompose(struct table *table, struct set *set)
 			compound_expr_add(new_init, expr_clone(left));
 	}
 
+	expr_free(set->init);
 	set->init = new_init;
 
 	return 0;
-- 
2.11.0




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux