From b33a454a42ad281275438a21b34bd446ff4e7492 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?= =?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= Date: Wed, 11 Apr 2018 12:48:06 +0000 Subject: [PATCH] W32 gstdio: don't close fd handle If a handle was obtained from a fd that we got from up the stack, we shouldn't call CloseHandle() on it in case of an error. This is a bug. Luckily, it happens only on the error codepath, so, hopefully, no one had hit it yet. --- glib/gstdio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/glib/gstdio.c b/glib/gstdio.c index 858d56999..9b674d753 100644 --- a/glib/gstdio.c +++ b/glib/gstdio.c @@ -199,7 +199,8 @@ _g_win32_stat_utf16_no_trailing_slashes (const gunichar2 *filename, if (!succeeded_so_far) { - CloseHandle (file_handle); + if (fd < 0) + CloseHandle (file_handle); errno = w32_error_to_errno (error_code); return -1; }