]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
src: Initialize struct stmt in _match and _target functions.
authorVarsha Rao <rvarsha016@gmail.com>
Sun, 20 Aug 2017 04:55:12 +0000 (10:25 +0530)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 24 Aug 2017 14:17:41 +0000 (16:17 +0200)
Initialize structure stmt with stmt_alloc in netlink_parse_target and
netlink_parse_match functions. This patch fixes the gcc warning:

‘stmt’ may be used uninitialized in this function.

Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/xt.c

index 3bc38eea36934f7cf666413331029877923fc233..9aff4143aa19eed78399fbd3bf95a3ac1385ac6a 100644 (file)
--- a/src/xt.c
+++ b/src/xt.c
@@ -143,6 +143,7 @@ void netlink_parse_match(struct netlink_parse_ctx *ctx,
        m->u.match_size = mt_len + XT_ALIGN(sizeof(struct xt_entry_match));
        m->u.user.revision = nftnl_expr_get_u32(nle, NFTNL_EXPR_MT_REV);
 
+       stmt = stmt_alloc(loc, NULL);
        stmt->xt.name = strdup(name);
        stmt->xt.type = NFT_XT_MATCH;
        stmt->xt.match = xt_match_clone(mt);
@@ -179,6 +180,7 @@ void netlink_parse_target(struct netlink_parse_ctx *ctx,
        t->u.user.revision = nftnl_expr_get_u32(nle, NFTNL_EXPR_TG_REV);
        strcpy(t->u.user.name, tg->name);
 
+       stmt = stmt_alloc(loc, NULL);
        stmt->xt.name = strdup(name);
        stmt->xt.type = NFT_XT_TARGET;
        stmt->xt.target = xt_target_clone(tg);