summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-08-17 02:47:44 +0200
committerwm4 <wm4@nowhere>2014-08-17 02:47:44 +0200
commit4822056db7a9f717eace337aeda760c35ab114d5 (patch)
tree54f8de0355e1145825081aeaa82c4805b83275e7
parentd811f6a9ed1b2ae3d4f95a88696330b8d91777ef (diff)
downloadmpv-4822056db7a9f717eace337aeda760c35ab114d5.tar.bz2
mpv-4822056db7a9f717eace337aeda760c35ab114d5.tar.xz
x11: fix memory leaks
Oh, we have to free this stuff. OK.
-rw-r--r--video/out/x11_common.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index d528456e28..6e60822644 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -335,12 +335,13 @@ static void xrandr_read(struct vo_x11_state *x11)
for (int o = 0; o < r->noutput; o++) {
RROutput output = r->outputs[o];
+ XRRCrtcInfo *crtc = NULL;
XRROutputInfo *out = XRRGetOutputInfo(x11->display, r, output);
if (!out || !out->crtc)
- continue;
- XRRCrtcInfo *crtc = XRRGetCrtcInfo(x11->display, r, out->crtc);
+ goto next;
+ crtc = XRRGetCrtcInfo(x11->display, r, out->crtc);
if (!crtc)
- continue;
+ goto next;
for (int om = 0; om < out->nmode; om++) {
RRMode xm = out->modes[om];
for (int n = 0; n < r->nmode; n++) {
@@ -360,6 +361,11 @@ static void xrandr_read(struct vo_x11_state *x11)
x11->displays[num] = d;
}
}
+ next:
+ if (crtc)
+ XRRFreeCrtcInfo(crtc);
+ if (out)
+ XRRFreeOutputInfo(out);
}
XRRFreeScreenResources(r);