public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Muli Ben-Yehuda <mulix@mulix.org>
To: James Morris <jmorris@intercode.com.au>
Cc: Andy Chou <acc@CS.Stanford.EDU>,
	Linux-Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [CHECKER] 6 memory leaks
Date: Sat, 19 Apr 2003 15:28:35 +0300	[thread overview]
Message-ID: <20030419122835.GA7975@actcom.co.il> (raw)
In-Reply-To: <Mutt.LNX.4.44.0304192206470.31750-100000@blackbird.intercode.com.au>

[-- Attachment #1: Type: text/plain, Size: 2192 bytes --]

On Sat, Apr 19, 2003 at 10:08:41PM +1000, James Morris wrote:
> On Sat, 19 Apr 2003, Muli Ben-Yehuda wrote:
> 
> > This one appears to be exactly the same as the previous one, except
> > the line number is different. Does that mean the checker things there
> > are two leaks in this piece of code? 
> 
> This one was for the ipv6 version.  If you could make a patch for ipv6, 
> I'll forward both to Dave Miller.

Here it is, thanks. 

Index: net/ipv4/netfilter/ip_queue.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv4/netfilter/ip_queue.c,v
retrieving revision 1.13
diff -u -r1.13 ip_queue.c
--- net/ipv4/netfilter/ip_queue.c	3 Apr 2003 16:59:51 -0000	1.13
+++ net/ipv4/netfilter/ip_queue.c	19 Apr 2003 11:35:11 -0000
@@ -300,8 +300,9 @@
 	write_lock_bh(&queue_lock);
 	
 	if (!peer_pid)
-		goto err_out_unlock;
+		goto err_out_free_nskb; 
 
+ 	/* netlink_unicast will either free the nskb or attach it to a socket */ 
 	status = netlink_unicast(ipqnl, nskb, peer_pid, MSG_DONTWAIT);
 	if (status < 0)
 		goto err_out_unlock;
@@ -312,6 +313,9 @@
 
 	write_unlock_bh(&queue_lock);
 	return status;
+
+err_out_free_nskb:
+	kfree_skb(nskb); 
 	
 err_out_unlock:
 	write_unlock_bh(&queue_lock);
Index: net/ipv6/netfilter/ip6_queue.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv6/netfilter/ip6_queue.c,v
retrieving revision 1.10
diff -u -r1.10 ip6_queue.c
--- net/ipv6/netfilter/ip6_queue.c	5 Apr 2003 01:30:47 -0000	1.10
+++ net/ipv6/netfilter/ip6_queue.c	19 Apr 2003 11:35:12 -0000
@@ -304,8 +304,9 @@
 	write_lock_bh(&queue_lock);
 	
 	if (!peer_pid)
-		goto err_out_unlock;
+		goto err_out_free_nskb; 
 
+ 	/* netlink_unicast will either free the nskb or attach it to a socket */ 
 	status = netlink_unicast(ipqnl, nskb, peer_pid, MSG_DONTWAIT);
 	if (status < 0)
 		goto err_out_unlock;
@@ -316,6 +317,9 @@
 
 	write_unlock_bh(&queue_lock);
 	return status;
+	
+err_out_free_nskb:
+	kfree_skb(nskb); 
 	
 err_out_unlock:
 	write_unlock_bh(&queue_lock);

-- 
Muli Ben-Yehuda
http://www.mulix.org


[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2003-04-19 12:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-19  2:50 [CHECKER] 6 memory leaks Andy Chou
2003-04-19  9:44 ` Muli Ben-Yehuda
2003-04-19  9:55   ` William Lee Irwin III
2003-04-19 10:02     ` Muli Ben-Yehuda
2003-04-19 10:13       ` William Lee Irwin III
2003-04-19 12:08   ` James Morris
2003-04-19 12:28     ` Muli Ben-Yehuda [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-04-21 20:27 Jean Tourrilhes
2003-04-21 20:53 ` William Lee Irwin III

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030419122835.GA7975@actcom.co.il \
    --to=mulix@mulix.org \
    --cc=acc@CS.Stanford.EDU \
    --cc=jmorris@intercode.com.au \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox