summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-06-27 14:22:28 +0200
committerwm4 <wm4@nowhere>2017-06-29 10:31:13 +0200
commitcd25d98bfa38c87bd857264e876cd8be42eb3678 (patch)
treef721ae2930ac3ce823326592f986f4f4c20654e6 /video
parent7eca787571aab982acaadee79abb0f40f9f14b6a (diff)
downloadmpv-cd25d98bfa38c87bd857264e876cd8be42eb3678.tar.bz2
mpv-cd25d98bfa38c87bd857264e876cd8be42eb3678.tar.xz
Avoid calling close(-1)
While this is perfectly OK on Unix, it causes annoying valgrind warnings, and might be otherwise confusing to others. On Windows, the runtime can actually abort the process if this is called. push.c part taken from a patch by Pedro Pombeiro.
Diffstat (limited to 'video')
-rw-r--r--video/out/x11_common.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index 26f861be06..670dca9147 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -762,8 +762,10 @@ void vo_x11_uninit(struct vo *vo)
sem_destroy(&x11->screensaver_sem);
}
- for (int n = 0; n < 2; n++)
- close(x11->wakeup_pipe[n]);
+ if (x11->wakeup_pipe[0] >= 0) {
+ close(x11->wakeup_pipe[0]);
+ close(x11->wakeup_pipe[1]);
+ }
talloc_free(x11);
vo->x11 = NULL;