From 4822056db7a9f717eace337aeda760c35ab114d5 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 17 Aug 2014 02:47:44 +0200 Subject: x11: fix memory leaks Oh, we have to free this stuff. OK. --- video/out/x11_common.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'video') 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); -- cgit v1.2.3