Skip to content

Commit

Permalink
linux-user: fix file descriptor leaks
Browse files Browse the repository at this point in the history
Handle variable "fd_orig" going out of scope leaks the handle.

Signed-off-by: zhanghailiang <[email protected]>
Reviewed-by: Gonglei <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
  • Loading branch information
colo-ft authored and Michael Tokarev committed Aug 24, 2014
1 parent bcc55f3 commit 680dfde
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions linux-user/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -5167,6 +5167,7 @@ static int open_self_cmdline(void *cpu_env, int fd)

if (word_skipped) {
if (write(fd, cp_buf, nb_read) != nb_read) {
close(fd_orig);
return -1;
}
}
Expand Down

0 comments on commit 680dfde

Please sign in to comment.