From 545360460625a9d4daa9040de8db852833b0793a Mon Sep 17 00:00:00 2001 From: James Ross-Gowan Date: Fri, 28 Jul 2017 23:00:46 +1000 Subject: subprocess-win: don't leak pipe handle on error --- osdep/subprocess-win.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'osdep') diff --git a/osdep/subprocess-win.c b/osdep/subprocess-win.c index b94be1a5ef..c662fb6301 100644 --- a/osdep/subprocess-win.c +++ b/osdep/subprocess-win.c @@ -126,8 +126,10 @@ static int create_overlapped_pipe(HANDLE *read, HANDLE *write) // Open the write end of the pipe as a synchronous handle *write = CreateFileW(buf, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (*write == INVALID_HANDLE_VALUE) + if (*write == INVALID_HANDLE_VALUE) { + CloseHandle(*read); goto error; + } return 0; error: -- cgit v1.2.3