From: David S. Miller Date: Sat, 1 Apr 2006 20:48:36 +0000 (-0800) Subject: [NET]: Fully fix the memory leaks in sys_accept(). X-Git-Tag: v2.6.17-rc1~18^2 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=9a1875e60e61b563737d8d1fc3876b279710fe93;p=linux-2.6-omap-h63xx.git [NET]: Fully fix the memory leaks in sys_accept(). Andi Kleen was right, fput() on sock->file will end up calling sock_release() if necessary. So here is the rest of his version of the fix for these leaks. Signed-off-by: David S. Miller --- diff --git a/net/socket.c b/net/socket.c index bbc80780f45..b807f360e02 100644 --- a/net/socket.c +++ b/net/socket.c @@ -1418,7 +1418,8 @@ asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr, int _ newfd = sock_alloc_fd(&newfile); if (unlikely(newfd < 0)) { err = newfd; - goto out_release; + sock_release(newsock); + goto out_put; } err = sock_attach_fd(newsock, newfile); @@ -1457,8 +1458,6 @@ out: out_fd: fput(newfile); put_unused_fd(newfd); -out_release: - sock_release(newsock); goto out_put; }