aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorzhanghailiang <zhang.zhanghailiang@huawei.com>2014-08-22 16:23:51 +0800
committerMichael Tokarev <mjt@tls.msk.ru>2014-08-24 13:18:28 +0400
commit680dfde91981516942ec557ef1c27753db24cbe8 (patch)
tree49a6bfa6bfae42db9d629fc5f500a114f566b7c4 /linux-user
parentbcc55f327c571295193880110c048b463bce6677 (diff)
downloadqemu-680dfde91981516942ec557ef1c27753db24cbe8.zip
qemu-680dfde91981516942ec557ef1c27753db24cbe8.tar.gz
qemu-680dfde91981516942ec557ef1c27753db24cbe8.tar.bz2
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>
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/syscall.c1
1 files changed, 1 insertions, 0 deletions
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 @@ 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;
}
}