• Pavel Tikhomirov's avatar
    mount: fix cwd_fd leak on clone error · f48bf982
    Pavel Tikhomirov authored
    We should close cwd_fd on error paths, found by Coverity Scan:
    
    *** CID 187162:  Resource leaks  (RESOURCE_LEAK)
    /criu/mount.c: 1370 in open_mountpoint()
    1364                     */
    1365                    pid = clone_noasan(ns_open_mountpoint, CLONE_VFORK | CLONE_VM
    1366                                    | CLONE_FILES | CLONE_IO | CLONE_SIGHAND
    1367                                    | CLONE_SYSVSEM, &ca);
    1368                    if (pid == -1) {
    1369                            pr_perror("Can't clone helper process");
    >>>     CID 187162:  Resource leaks  (RESOURCE_LEAK)
    >>>     Handle variable "cwd_fd" going out of scope leaks the handle.
    1370                            return -1;
    1371                    }
    1372
    1373                    errno = 0;
    1374                    if (waitpid(pid, &status, __WALL) != pid || !WIFEXITED(status)
    1375                                    || WEXITSTATUS(status)) {
    Signed-off-by: 's avatarPavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
    f48bf982
Name
Last commit
Last update
Documentation Loading commit data...
compel Loading commit data...
contrib Loading commit data...
coredump Loading commit data...
crit Loading commit data...
criu Loading commit data...
images Loading commit data...
include/common Loading commit data...
lib Loading commit data...
scripts Loading commit data...
soccr Loading commit data...
test Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
.travis.yml Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
INSTALL.md Loading commit data...
Makefile Loading commit data...
Makefile.compel Loading commit data...
Makefile.config Loading commit data...
Makefile.install Loading commit data...
Makefile.versions Loading commit data...
README.md Loading commit data...