[PATCH] fix memory leak in socket.c

Robert Love (rml@tech9.net)
15 Jul 2002 16:09:26 -0700


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

diff -urN linux-2.4.19-sausage/net/socket.c linux/net/socket.c
--- linux-sausage/net/socket.c Mon Jun 10 15:26:30 2002
+++ linux/net/socket.c Mon Jun 10 15:37:48 2002
@@ -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);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/