From 680dfde91981516942ec557ef1c27753db24cbe8 Mon Sep 17 00:00:00 2001 From: zhanghailiang Date: Fri, 22 Aug 2014 16:23:51 +0800 Subject: [PATCH] linux-user: fix file descriptor leaks Handle variable "fd_orig" going out of scope leaks the handle. Signed-off-by: zhanghailiang Reviewed-by: Gonglei Signed-off-by: Michael Tokarev --- linux-user/syscall.c | 1 + 1 file changed, 1 insertion(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 7ff7c21255..8fe9df7b87 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; } }