[lxc-devel] [PATCH 1/4] c/r: use fclose instead of close

Tycho Andersen tycho.andersen at canonical.com
Tue Jun 9 01:59:51 UTC 2015


We're leaking the FILE* here while closing the underlying fd; let's just
close the file and thus close both.

Reported-by: Coverity
Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 src/lxc/criu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lxc/criu.c b/src/lxc/criu.c
index 667f5d9..adcc626 100644
--- a/src/lxc/criu.c
+++ b/src/lxc/criu.c
@@ -279,11 +279,11 @@ static bool criu_version_ok()
 			goto version_error;
 
 version_match:
-		close(pipes[0]);
+		fclose(f);
 		return true;
 
 version_error:
-		close(pipes[0]);
+		fclose(f);
 		ERROR("must have criu " CRIU_VERSION " or greater to checkpoint/restore\n");
 		return false;
 	}
-- 
2.1.4



More information about the lxc-devel mailing list