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>
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 7ff7c21..8fe9df7 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5167,6 +5167,7 @@
if (word_skipped) {
if (write(fd, cp_buf, nb_read) != nb_read) {
+ close(fd_orig);
return -1;
}
}