[PATCH] randr: first check pScrPriv before using the pointer at RRFirstOutput

Ricardo Salveti de Araujo ricardo.salveti at linaro.org
Wed Jun 20 20:55:53 PDT 2012


Fix a seg fault in case pScrPriv is NULL at ProcRRGetScreenInfo,
which later calls RRFirstOutput.

Signed-off-by: Ricardo Salveti de Araujo <ricardo.salveti at linaro.org>
---
 randr/randr.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/randr/randr.c b/randr/randr.c
index 4d4298a..103da48 100644
--- a/randr/randr.c
+++ b/randr/randr.c
@@ -446,6 +446,9 @@ RRFirstOutput(ScreenPtr pScreen)
     RROutputPtr output;
     int i, j;
 
+    if (!pScrPriv)
+        return NULL;
+
     if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc)
         return pScrPriv->primaryOutput;
 
-- 
1.7.9.5



More information about the xorg-devel mailing list