From mboxrd@z Thu Jan 1 00:00:00 1970 From: Patrick McHardy Subject: [NETFILTER 3/3]: SNMP NAT: fix memleak in snmp_object_decode Date: Tue, 23 May 2006 11:41:53 +0200 Message-ID: <4472D8E1.5010106@trash.net> Mime-Version: 1.0 Content-Type: text/plain; name="03.diff" Content-Transfer-Encoding: 7bit Cc: Netfilter Development Mailinglist Return-path: To: "David S. Miller" Content-Disposition: inline; filename="03.diff" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: netfilter-devel-bounces@lists.netfilter.org Errors-To: netfilter-devel-bounces@lists.netfilter.org List-Id: netfilter-devel.vger.kernel.org [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 Signed-off-by: Patrick McHardy --- commit 3eb1830bb0cf13f1e9906e96b6b21d512adfbafd tree afc2fb8b065ed275e4c5d6680858a62126b34f8b parent e79f105111e9a6088868a879934d0574ce6230ad author Chris Wright Tue, 23 May 2006 11:23:17 +0200 committer Patrick McHardy Tue, 23 May 2006 11:23:17 +0200 net/ipv4/netfilter/ip_nat_snmp_basic.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/net/ipv4/netfilter/ip_nat_snmp_basic.c b/net/ipv4/netfilter/ip_nat_snmp_basic.c index c622538..1017d12 100644 --- a/net/ipv4/netfilter/ip_nat_snmp_basic.c +++ b/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__);