Commit 1418492f authored by Andrei Vagin's avatar Andrei Vagin Committed by Pavel Emelyanov

files: don't leak a file descriptor

CID 173737 (#1 of 2): Resource leak (RESOURCE_LEAK)
9. leaked_handle: Handle variable rmntns_root going out of scope leaks the handle.

travis-ci: success for files: don't leak a file descriptor
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent a99b7c1b
......@@ -540,9 +540,11 @@ static int clean_linked_remap(struct remap_info *ri)
ret = unlinkat(rmntns_root, remap->rpath, remap->is_dir ? AT_REMOVEDIR : 0);
if (ret < 0) {
close(rmntns_root);
pr_perror("Couldn't unlink remap %d %s", rmntns_root, remap->rpath);
return -1;
}
close(rmntns_root);
remap->rpath[0] = 0;
return 0;
......
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