diff mbox

netfilter: nfnetlink_acct: Fixing memory leak

Message ID 1401673378-20755-1-git-send-email-mathieu.poirier@linaro.org
State Accepted
Headers show

Commit Message

Mathieu Poirier June 2, 2014, 1:42 a.m. UTC
From: Mathieu Poirier <mathieu.poirier@linaro.org>

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>
---
 net/netfilter/nfnetlink_acct.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Pablo Neira Ayuso June 2, 2014, 8:48 a.m. UTC | #1
On Sun, Jun 01, 2014 at 07:42:58PM -0600, mathieu.poirier@linaro.org wrote:
> From: Mathieu Poirier <mathieu.poirier@linaro.org>
> 
> 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.

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/netfilter/nfnetlink_acct.c b/net/netfilter/nfnetlink_acct.c
index 70e86bb..54af985 100644
--- a/net/netfilter/nfnetlink_acct.c
+++ b/net/netfilter/nfnetlink_acct.c
@@ -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)