From: Marco Peereboom Date: Thu, 22 Jan 2009 23:06:45 +0000 (+0000) Subject: Fix segfault on linux; from nicm X-Git-Url: https://jasonwoof.com/gitweb/?a=commitdiff_plain;h=238662f0274ef1a90c168bedd4eb24281f278eaa;p=spectrwm.git Fix segfault on linux; from nicm --- 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,