summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossy@jrg.systems>2017-07-28 23:00:46 +1000
committerJames Ross-Gowan <rossy@jrg.systems>2017-07-28 23:00:46 +1000
commit545360460625a9d4daa9040de8db852833b0793a (patch)
tree782e795c33b91a933ffb5976280227be9db8ce4f
parent345bb193fe75ddbf2f21bd295869276b6fa87189 (diff)
downloadmpv-545360460625a9d4daa9040de8db852833b0793a.tar.bz2
mpv-545360460625a9d4daa9040de8db852833b0793a.tar.xz
subprocess-win: don't leak pipe handle on error
-rw-r--r--osdep/subprocess-win.c4
1 files changed, 3 insertions, 1 deletions
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: