Be a bit more pedantic when getting outputs for a crtc, in that if

xrandr returns 0 outputs, then free resources and return null quickly.

Signed-off-by: Christopher Michael <cp.michael@samsung.com>

SVN revision: 83623
This commit is contained in:
Christopher Michael 2013-02-05 10:51:57 +00:00 committed by Christopher Michael
parent f317906408
commit 0c76117e1e
1 changed files with 12 additions and 0 deletions

View File

@ -1135,6 +1135,18 @@ ecore_x_randr_crtc_outputs_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, int
/* try to get crtc info */
if ((info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc)))
{
/* if we have no outputs, return NULL */
if (info->noutput == 0)
{
/* free the crtc info */
XRRFreeCrtcInfo(info);
/* free the resources */
XRRFreeScreenResources(res);
return NULL;
}
/* try to allocate our return struct */
if ((ret = malloc(info->noutput * sizeof(Ecore_X_Randr_Output))))
{