Skip to content

Commit

Permalink
netfilter: nfnetlink_acct: Fix memory leak
Browse files Browse the repository at this point in the history
Allocation of memory need only to happen once, that is
after the proper checks on the NFACCT_FLAGS have been
done.  Otherwise the code can return without freeing
already allocated memory.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Mathieu Poirier authored and Pablo Neira Ayuso committed Jun 2, 2014
1 parent 96b2e73 commit 4c552a6
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion net/netfilter/nfnetlink_acct.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ nfnl_acct_new(struct sock *nfnl, struct sk_buff *skb,
return -EBUSY;
}

nfacct = kzalloc(sizeof(struct nf_acct), GFP_KERNEL);
if (tb[NFACCT_FLAGS]) {
flags = ntohl(nla_get_be32(tb[NFACCT_FLAGS]));
if (flags & ~NFACCT_F_QUOTA)
Expand Down

0 comments on commit 4c552a6

Please sign in to comment.