[NETFILTER]: SNMP NAT: fix memleak in snmp_object_decode

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

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Chris Wright 2006-05-23 15:08:13 -07:00 committed by David S. Miller
parent 4d942d8b39
commit 4a06373913
1 changed files with 1 additions and 0 deletions

View File

@ -768,6 +768,7 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
len *= sizeof(unsigned long); len *= sizeof(unsigned long);
*obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC); *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC);
if (*obj == NULL) { if (*obj == NULL) {
kfree(lp);
kfree(id); kfree(id);
if (net_ratelimit()) if (net_ratelimit())
printk("OOM in bsalg (%d)\n", __LINE__); printk("OOM in bsalg (%d)\n", __LINE__);