[lxc-devel] [lxc/master] parse.c: fix fd leak from memfd_create

tanyifeng on Github lxc-bot at linuxcontainers.org
Thu Jun 20 08:30:34 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 349 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190620/de365d77/attachment.bin>
-------------- next part --------------
From 22c8ac96f6cdddca1e3788c888c7d837fedf9c44 Mon Sep 17 00:00:00 2001
From: t00416110 <tanyifeng1 at huawei.com>
Date: Thu, 20 Jun 2019 16:26:59 -0400
Subject: [PATCH] parse.c: fix fd leak from memfd_create

Signed-off-by: t00416110 <tanyifeng1 at huawei.com>
---
 src/lxc/parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lxc/parse.c b/src/lxc/parse.c
index 01068ccb34..36bbfdbc7b 100644
--- a/src/lxc/parse.c
+++ b/src/lxc/parse.c
@@ -98,7 +98,7 @@ int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback, void *da
 	fd = open(file, O_RDONLY | O_CLOEXEC);
 	if (fd < 0) {
 		SYSERROR("Failed to open file \"%s\"", file);
-		return -1;
+		goto on_error;
 	}
 
 	/* sendfile() handles up to 2GB. No config file should be that big. */


More information about the lxc-devel mailing list