Commit ab433857 authored by Libo Chen's avatar Libo Chen Committed by Pavel Emelyanov

cr-check: potential fd leak in check_fdinfo_inotify

Without this patch, ifd will leak when inotify_add_watch fail.
Signed-off-by: 's avatarLibo Chen <libo.chen@huawei.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 61d852e7
...@@ -342,6 +342,7 @@ static int check_fdinfo_inotify(void) ...@@ -342,6 +342,7 @@ static int check_fdinfo_inotify(void)
wd = inotify_add_watch(ifd, ".", IN_ALL_EVENTS); wd = inotify_add_watch(ifd, ".", IN_ALL_EVENTS);
if (wd < 0) { if (wd < 0) {
pr_perror("Can't add watch"); pr_perror("Can't add watch");
close(ifd);
return -1; return -1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment