crtc/gamma: check xf86_config is valid before using it.

If you have multiple cards, some that support randr 1.2 and some that don't
you can get a null dereference in here.

Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Dave Airlie 2009-06-05 11:57:39 +10:00
parent da682abc78
commit b6c16fc7da

View File

@ -3140,6 +3140,9 @@ xf86_crtc_supports_gamma(ScrnInfoPtr pScrn)
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
xf86CrtcPtr crtc;
/* for multiple drivers loaded we need this */
if (!xf86_config)
return FALSE;
if (xf86_config->num_crtc == 0)
return FALSE;
crtc = xf86_config->crtc[0];