mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-01 06:45:35 +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:
committed by
Pavel Emelyanov
parent
7071d52088
commit
ad6db8332b
4
mount.c
4
mount.c
@@ -787,8 +787,10 @@ int mntns_collect_root(pid_t pid)
|
|||||||
|
|
||||||
pfd = open_pid_proc(pid);
|
pfd = open_pid_proc(pid);
|
||||||
ret = readlinkat(pfd, "root", path, sizeof(path) - 1);
|
ret = readlinkat(pfd, "root", path, sizeof(path) - 1);
|
||||||
if (ret < 0)
|
if (ret < 0){
|
||||||
|
close_pid_proc();
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
path[ret] = '\0';
|
path[ret] = '\0';
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user