From 238662f0274ef1a90c168bedd4eb24281f278eaa Mon Sep 17 00:00:00 2001 From: Marco Peereboom Date: Thu, 22 Jan 2009 23:06:45 +0000 Subject: [PATCH] Fix segfault on linux; from nicm --- scrotwm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scrotwm.c b/scrotwm.c index 6f26b63..ca2a281 100644 --- a/scrotwm.c +++ b/scrotwm.c @@ -2024,7 +2024,7 @@ setup_screens(void) else ncrtc = sr->ncrtc; - for (c = 0; c < ncrtc; c++) { + for (c = 0, ci = NULL; c < ncrtc; c++) { ci = XRRGetCrtcInfo(display, sr, sr->crtcs[c]); if (ci->noutput == 0) continue; @@ -2038,7 +2038,8 @@ setup_screens(void) ci->x, ci->y, ci->width, ci->height); w++; } - XRRFreeCrtcInfo(ci); + if (ci) + XRRFreeCrtcInfo(ci); XRRFreeScreenResources(sr); #else new_region(&screens[i], &screens[i].ws[w], 0, 0, -- 1.7.10.4