open_inet_sk(): don't leak socket fd on error

Reported by Coverity, CID 51628.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Andrew Vagin <avagin@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Kir Kolyshkin 2015-05-05 15:31:08 -07:00 committed by Pavel Emelyanov
parent c6e724f61a
commit 5e82fba10e

View file

@ -501,7 +501,7 @@ static int open_inet_sk(struct file_desc *d)
if (ie->v6only) {
if (restore_opt(sk, SOL_IPV6, IPV6_V6ONLY, &yes) == -1)
return -1;
goto err;
}
/*
@ -509,7 +509,7 @@ static int open_inet_sk(struct file_desc *d)
* The origin value of SO_REUSEADDR will be restored in post_open.
*/
if (restore_opt(sk, SOL_SOCKET, SO_REUSEADDR, &yes))
return -1;
goto err;
if (tcp_connection(ie)) {
if (!opts.tcp_established_ok) {