[lxc-devel] [lxc/master] fix fd handle leak

2xsec on Github lxc-bot at linuxcontainers.org
Tue Jun 19 01:28:35 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 398 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180619/93d6d2bb/attachment.bin>
-------------- next part --------------
From 22417436da4ab51d85268edb8c04d2af918c0ff5 Mon Sep 17 00:00:00 2001
From: Donghwa Jeong <dh48.jeong at samsung.com>
Date: Tue, 19 Jun 2018 10:27:33 +0900
Subject: [PATCH] fix fd handle leak

Signed-off-by: Donghwa Jeong <dh48.jeong at samsung.com>
---
 src/lxc/cmd/lxc_usernsexec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/lxc/cmd/lxc_usernsexec.c b/src/lxc/cmd/lxc_usernsexec.c
index 56e1bdbcb..cfe5db26c 100644
--- a/src/lxc/cmd/lxc_usernsexec.c
+++ b/src/lxc/cmd/lxc_usernsexec.c
@@ -91,6 +91,7 @@ static void opentty(const char * tty, int which) {
 	flags &= ~O_NONBLOCK;
 	if (fcntl(fd, F_SETFL, flags) < 0) {
 		printf("WARN: could not set fd flags: %s\n", strerror(errno));
+		close(fd);
 		return;
 	}
 


More information about the lxc-devel mailing list