Patchwork netfilter/ipv4: snmp nat leaks memory in case of failure

login
register
mail settings
Submitter Ilpo Järvinen
Date Oct. 16, 2008, 9:19 a.m.
Message ID <Pine.LNX.4.64.0810161218040.5522@wrl-59.cs.helsinki.fi>
Download mbox | patch
Permalink /patch/4668/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Ilpo Järvinen - Oct. 16, 2008, 9:19 a.m.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
---
 net/ipv4/netfilter/nf_nat_snmp_basic.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Patrick McHardy - Oct. 16, 2008, 12:02 p.m.
Ilpo Järvinen wrote:

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

Patch

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__);