Subject: netfilter 04/07: snmp nat leaks memory in case of failure

From: Patrick McHardy <[email-masked]>
Date: Mon, 20 Oct 2008 11:54:13 +0200 (MEST)

commit f935265f6041e490715ec31c7f918b8c348b5b95
Author: \"Ilpo Jarvinen\ <[email-masked]>
Date:   Sat Oct 18 15:20:56 2008 +0200

    netfilter: snmp nat leaks memory in case of failure
    
    Signed-off-by: Ilpo Järvinen <[email-masked]>
    Signed-off-by: Patrick McHardy <[email-masked]>

diff --git a/net/ipv4/netfilter/nf_nat_snmp_basic.c b/net/ipv4/netfilter/nf_nat_snmp_basic.c
index ffeaffc..8303e4b 100644
--- a/net/ipv4/netfilter/nf_nat_snmp_basic.c
+++ b/net/ipv4/netfilter/nf_nat_snmp_basic.c
@@ -742,6 +742,7 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
 			*obj = kmalloc(sizeof(struct snmp_object) + len,
 				       GFP_ATOMIC);
 			if (*obj == NULL) {
+				kfree(p);
 				kfree(id);
 				if (net_ratelimit())
 					printk("OOM in bsalg (%d)\n", __LINE__);