diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-04-01 15:48:36 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-04-01 15:48:36 -0500 |
commit | 9a1875e60e61b563737d8d1fc3876b279710fe93 (patch) | |
tree | 68b54f8b90b046d6cd49f0560c40b1cddb5502a2 /net | |
parent | 2722971cbe831117686039d5c334f2c0f560be13 (diff) |
[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 <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/socket.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/net/socket.c b/net/socket.c index bbc80780f45a..b807f360e02c 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 _ | |||
1418 | newfd = sock_alloc_fd(&newfile); | 1418 | newfd = sock_alloc_fd(&newfile); |
1419 | if (unlikely(newfd < 0)) { | 1419 | if (unlikely(newfd < 0)) { |
1420 | err = newfd; | 1420 | err = newfd; |
1421 | goto out_release; | 1421 | sock_release(newsock); |
1422 | goto out_put; | ||
1422 | } | 1423 | } |
1423 | 1424 | ||
1424 | err = sock_attach_fd(newsock, newfile); | 1425 | err = sock_attach_fd(newsock, newfile); |
@@ -1457,8 +1458,6 @@ out: | |||
1457 | out_fd: | 1458 | out_fd: |
1458 | fput(newfile); | 1459 | fput(newfile); |
1459 | put_unused_fd(newfd); | 1460 | put_unused_fd(newfd); |
1460 | out_release: | ||
1461 | sock_release(newsock); | ||
1462 | goto out_put; | 1461 | goto out_put; |
1463 | } | 1462 | } |
1464 | 1463 | ||