From: Christian Brauner Date: Sat, 28 Apr 2018 22:43:34 +0000 (+0200) Subject: coverity: #1435203 X-Git-Tag: lxc-3.1.0~318^2~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1768f3f2527463af508aed60b5171bc7e82025a;p=thirdparty%2Flxc.git coverity: #1435203 Resource leak Signed-off-by: Christian Brauner --- diff --git a/src/lxc/parse.c b/src/lxc/parse.c index 4a0df1863..d3589c1f5 100644 --- a/src/lxc/parse.c +++ b/src/lxc/parse.c @@ -83,8 +83,10 @@ int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback, return -1; } - if (st.st_size == 0) + if (st.st_size == 0) { + close(fd); return 0; + } buf = lxc_strmmap(NULL, st.st_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); if (buf == MAP_FAILED) {