Skip to content

Commit

Permalink
files: don't leak a file descriptor on an error path
Browse files Browse the repository at this point in the history
CID 84652 (#1 of 1): Resource leak (RESOURCE_LEAK)
6. leaked_handle: Handle variable newfd going out of scope leaks the handle.
  • Loading branch information
avagin committed Oct 30, 2015
1 parent fc3eab8 commit 593578c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions files.c
Original file line number Diff line number Diff line change
Expand Up @@ -1526,6 +1526,7 @@ int inherit_fd_resolve_clash(int fd)
}

if (close(fd) == -1) {
close(newfd);
pr_perror("Can't close inherit fd %d", fd);
return -1;
}
Expand Down

0 comments on commit 593578c

Please sign in to comment.