2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

mountns: potential fd leak when readlinkat call

when mntns_collect_root->readlinkat call faild, we should close pdf

Signed-off-by: Libo Chen <libo.chen@huawei.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Libo Chen
2013-05-16 21:00:43 +08:00
committed by Pavel Emelyanov
parent 7071d52088
commit ad6db8332b

View File

@@ -787,8 +787,10 @@ int mntns_collect_root(pid_t pid)
pfd = open_pid_proc(pid);
ret = readlinkat(pfd, "root", path, sizeof(path) - 1);
if (ret < 0)
if (ret < 0){
close_pid_proc();
return ret;
}
path[ret] = '\0';