From: zhanghailiang Date: Fri, 22 Aug 2014 08:23:51 +0000 (+0800) Subject: linux-user: fix file descriptor leaks X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=680dfde91981516942ec557ef1c27753db24cbe8;p=people%2Fliuw%2Flibxenctrl-split%2Fqemu-xen.git 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 --- diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 7ff7c2125..8fe9df7b8 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; } }