Skip to contentSkip to conversation

fix memory leak in socket.c

PATCH In review Robert Love 2 participants 2 messages Jul 15, 2002 – Jul 16, 2002

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix memory leak in socket.c

This fixes a memory leak in sock_fasync :: net/socket.c.

I sent a fix to Linus and it is now in 2.5.

2.4 and 2.4-ac still require the fix... the following patch applies to 2.4.19-rc1 and 2.4.19-rc1-ac5.

Robert Love

net/socket.c +4 -2
diff -urN linux-2.4.19-sausage/net/socket.c linux/net/socket.c
@@ -743,11 +743,13 @@
 			return -ENOMEM;
 	}
 
-
 	sock = socki_lookup(filp->f_dentry->d_inode);
 	
-	if ((sk=sock->sk) == NULL)
+	if ((sk=sock->sk) == NULL) {
+		if (fna)
+			kfree(fna);
 		return -EINVAL;
+	}
 
 	lock_sock(sk);