[PATCH] Netfilter: SNMP NAT helper: fix memleak snmp_object_decode

Chris Wright chrisw at sous-sol.org
Tue May 23 00:40:39 CEST 2006


If kmalloc fails, error path leaks data allocated from asn1_oid_decode().

Signed-off-by: Chris Wright <chrisw at sous-sol.org>
---

 net/ipv4/netfilter/ip_nat_snmp_basic.c |    1 +
 1 file changed, 1 insertion(+)

--- linus-2.6.orig/net/ipv4/netfilter/ip_nat_snmp_basic.c
+++ linus-2.6/net/ipv4/netfilter/ip_nat_snmp_basic.c
@@ -768,6 +768,7 @@ static unsigned char snmp_object_decode(
 			len *= sizeof(unsigned long);
 			*obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC);
 			if (*obj == NULL) {
+				kfree(lp);
 				kfree(id);
 				if (net_ratelimit())
 					printk("OOM in bsalg (%d)\n", __LINE__);



More information about the netfilter-devel mailing list