[CRIU] [PATCH 1/5] open_inet_sk(): don't leak socket fd on error

Kir Kolyshkin kir at openvz.org
Tue May 5 15:31:08 PDT 2015


Reported by Coverity, CID 51628.

Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 sk-inet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sk-inet.c b/sk-inet.c
index 539c80c..b961741 100644
--- a/sk-inet.c
+++ b/sk-inet.c
@@ -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) {
-- 
1.9.3



More information about the CRIU mailing list