[14/14] pid_ns: Close sk in case of pid_ns_helper_sock() fails

Submitted by Kirill Tkhai on May 15, 2017, 1:06 p.m.

Details

Message ID 149485357937.681.914939539915117787.stgit@localhost.localdomain
State New
Series "Refactor pid_ns helpers creation"
Headers show

Commit Message

Kirill Tkhai May 15, 2017, 1:06 p.m.
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 criu/namespaces.c |    1 +
 1 file changed, 1 insertion(+)

Patch hide | download patch | download mbox

diff --git a/criu/namespaces.c b/criu/namespaces.c
index f9ab66be4..3473ab13b 100644
--- a/criu/namespaces.c
+++ b/criu/namespaces.c
@@ -2575,6 +2575,7 @@  static int pid_ns_helper_sock(struct ns_id *ns)
 
 	if (bind(sk, (struct sockaddr *)&addr, len) < 0) {
 		pr_perror("Can't bind pid_ns sock");
+		close(sk);
 		return -1;
 	}