subprocess-win: don't leak pipe handle on error

This commit is contained in:
James Ross-Gowan 2017-07-28 23:00:46 +10:00
parent 345bb193fe
commit 5453604606
1 changed files with 3 additions and 1 deletions

View File

@ -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: