[CRIU] [PATCH 2/2] cr-check: potential fd leak in check_fdinfo_inotify

Libo Chen clbchenlibo.chen at huawei.com
Thu May 2 03:02:36 EDT 2013


Without this patch, ifd will leak when inotify_add_watch fail.

Signed-off-by: Libo Chen <libo.chen at huawei.com>
---
 cr-check.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/cr-check.c b/cr-check.c
index 700ee03..5868a2e 100755
--- a/cr-check.c
+++ b/cr-check.c
@@ -342,6 +342,7 @@ static int check_fdinfo_inotify(void)
 	wd = inotify_add_watch(ifd, ".", IN_ALL_EVENTS);
 	if (wd < 0) {
 		pr_perror("Can't add watch");
+		close(ifd);
 		return -1;
 	}

-- 
1.7.10.4



More information about the CRIU mailing list