xfree86: Return NULL from xf86CompatOutput if no compat_output is defined

If no compat_output is defined, we inadvertently (attempt to) return
whatever data is at index -1. Instead, return NULL since that's what
callers are expecting.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
(cherry picked from commit 28159eff6b)
This commit is contained in:
Jason Gerecke 2015-04-30 18:06:14 -07:00 committed by Adam Jackson
parent 9e39ba30f1
commit 5497f56b87

View File

@ -732,6 +732,8 @@ xf86CompatOutput(ScrnInfoPtr pScrn)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
if (config->compat_output < 0)
return NULL;
return config->output[config->compat_output];
}