Commit 7ae28d31 authored by Robert Love's avatar Robert Love Committed by Linus Torvalds

[PATCH] net/socket.c memory leak fix

The always-appreciated Stanford Checker found a memory leak in
net/socket.c :: sock_fasync.  It was a bit tricky since the memory was
only conditionally allocated, so must only conditionally be freed.
parent b533e812
...@@ -758,11 +758,13 @@ static int sock_fasync(int fd, struct file *filp, int on) ...@@ -758,11 +758,13 @@ static int sock_fasync(int fd, struct file *filp, int on)
return -ENOMEM; return -ENOMEM;
} }
sock = SOCKET_I(filp->f_dentry->d_inode); sock = SOCKET_I(filp->f_dentry->d_inode);
if ((sk=sock->sk) == NULL) if ((sk=sock->sk) == NULL) {
if (fna)
kfree(fna);
return -EINVAL; return -EINVAL;
}
lock_sock(sk); lock_sock(sk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment