linux-user: fix file descriptor leaks
Handle variable "fd_orig" going out of scope leaks the handle. Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Reviewed-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
parent
bcc55f327c
commit
680dfde919
@ -5167,6 +5167,7 @@ static int open_self_cmdline(void *cpu_env, int fd)
|
|||||||
|
|
||||||
if (word_skipped) {
|
if (word_skipped) {
|
||||||
if (write(fd, cp_buf, nb_read) != nb_read) {
|
if (write(fd, cp_buf, nb_read) != nb_read) {
|
||||||
|
close(fd_orig);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user