nftnlrdr_misc.c: fix a memory leak in table_cb()

This commit is contained in:
Thomas Bernard 2020-06-08 10:08:44 +02:00
parent 5f66d1852d
commit 92ec4d05ab
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C
1 changed files with 9 additions and 3 deletions

View File

@ -497,7 +497,6 @@ table_cb(const struct nlmsghdr *nlh, void *data)
{
int result = MNL_CB_OK;
struct nftnl_rule *rule;
struct nftnl_expr *expr;
struct nftnl_expr_iter *itr;
UNUSED(data);
@ -556,9 +555,16 @@ table_cb(const struct nlmsghdr *nlh, void *data)
}
itr = nftnl_expr_iter_create(rule);
if (itr == NULL) {
syslog(LOG_ERR, "%s: nftnl_expr_iter_create() FAILED",
"table_cb");
} else {
struct nftnl_expr *expr;
while ((expr = nftnl_expr_iter_next(itr)) != NULL) {
rule_expr_cb(expr, r);
while ((expr = nftnl_expr_iter_next(itr)) != NULL) {
rule_expr_cb(expr, r);
}
nftnl_expr_iter_destroy(itr);
}
switch (r->type) {