netdev
[Top] [All Lists]

Re: memory leak in net/sched/ipt.c?

To: yxie@xxxxxxxxxxxxxxx (Yichen Xie)
Subject: Re: memory leak in net/sched/ipt.c?
From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 23 Mar 2005 22:30:49 +1100
Cc: linux-kernel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxx, davem@xxxxxxxxxxxxx, kaber@xxxxxxxxx, hadi@xxxxxxxxxx
In-reply-to: <Pine.LNX.4.61.0503230011090.4207@kaki.stanford.edu>
Organization: Core
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: tin/1.7.4-20040225 ("Benbecula") (UNIX) (Linux/2.4.27-hx-1-686-smp (i686))
Yichen Xie <yxie@xxxxxxxxxxxxxxx> wrote:
> Is the memory block allocated on line 315 leaked every time tcp_ipt_dump 
> is called?

It seems to be.  This patch should free it.

Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>

BTW, please report networking bugs to netdev@xxxxxxxxxxxx

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
===== net/sched/ipt.c 1.14 vs edited =====
--- 1.14/net/sched/ipt.c        2005-02-07 16:39:40 +11:00
+++ edited/net/sched/ipt.c      2005-03-23 22:28:13 +11:00
@@ -284,10 +284,12 @@
        tm.lastuse = jiffies_to_clock_t(jiffies - p->tm.lastuse);
        tm.expires = jiffies_to_clock_t(p->tm.expires);
        RTA_PUT(skb, TCA_IPT_TM, sizeof (tm), &tm);
+       kfree(t);
        return skb->len;
 
       rtattr_failure:
        skb_trim(skb, b - skb->data);
+       kfree(t);
        return -1;
 }
 

<Prev in Thread] Current Thread [Next in Thread>