[PATCH] net/socket.c : remove redundant NULL pointer check before kfree()

STALE7805d

2 messages, 2 authors, 2005-03-23 · open the first message on its own page

[PATCH] net/socket.c : remove redundant NULL pointer check before kfree()

From: Jesper Juhl <hidden>
Date: 2005-03-17 19:32:41

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


Signed-off-by: Jesper Juhl <redacted>
--- 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)

Re: [PATCH] net/socket.c : remove redundant NULL pointer check before kfree()

From: "David S. Miller" <davem@davemloft.net>
Date: 2005-03-23 02:49:48

On Thu, 17 Mar 2005 20:34:05 +0100 (CET)
Jesper Juhl [off-list ref] wrote:
kfree() handles NULL pointers just fine, checking first is pointless.

Signed-off-by: Jesper Juhl <redacted>
Applied, thanks Jesper.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help