mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] net/socket.c : remove redundant NULL pointer check before kfree()
@ 2005-03-17 19:34 Jesper Juhl
  2005-03-23  2:47 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jesper Juhl @ 2005-03-17 19:34 UTC (permalink / raw)
  To: netdev
  Cc: Orest Zborowski, Ross Biro, Fred N. van Kempen, David S. Miller,
	linux-net, linux-kernel


kfree() handles NULL pointers just fine, checking first is pointless.


Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>

--- linux-2.6.11-mm4-orig/net/socket.c	2005-03-16 15:45:42.000000000 +0100
+++ linux-2.6.11-mm4/net/socket.c	2005-03-17 20:25:36.000000000 +0100
@@ -993,8 +993,7 @@ static int sock_fasync(int fd, struct fi
 	sock = SOCKET_I(filp->f_dentry->d_inode);
 
 	if ((sk=sock->sk) == NULL) {
-		if (fna)
-			kfree(fna);
+		kfree(fna);
 		return -EINVAL;
 	}
 




(Please CC me on replies to lists other than linux-kernel)



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] net/socket.c : remove redundant NULL pointer check before kfree()
  2005-03-17 19:34 [PATCH] net/socket.c : remove redundant NULL pointer check before kfree() Jesper Juhl
@ 2005-03-23  2:47 ` David S. Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2005-03-23  2:47 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: netdev, obz, bir7, waltje, linux-net, linux-kernel

On Thu, 17 Mar 2005 20:34:05 +0100 (CET)
Jesper Juhl <juhl-lkml@dif.dk> wrote:

> kfree() handles NULL pointers just fine, checking first is pointless.
> 
> Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>

Applied, thanks Jesper.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-03-23  2:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-17 19:34 [PATCH] net/socket.c : remove redundant NULL pointer check before kfree() Jesper Juhl
2005-03-23  2:47 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®