[CRIU] [PATCH 3/4] service: don't leak a zero file descriptor

Andrey Vagin avagin at openvz.org
Fri Dec 20 13:13:32 PST 2013


CID 1141017 (#1-2 of 2): Resource leak (RESOURCE_LEAK)
14. leaked_handle: Handle variable fd going out of scope leaks the handle.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 lib/criu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/criu.c b/lib/criu.c
index fc7a801..d3ab3ee 100644
--- a/lib/criu.c
+++ b/lib/criu.c
@@ -211,7 +211,7 @@ static int send_req_and_recv_resp(CriuReq *req, CriuResp **resp)
 	}
 
 exit:
-	if (fd > 0)
+	if (fd >= 0)
 		close(fd);
 
 	return -ret;
-- 
1.8.3.1



More information about the CRIU mailing list