Trap for number of crtcs < 1 so we do not try to allocate space for

zero crtcs.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2013-07-25 12:32:49 +01:00
parent d112487e84
commit f287fd33a7
1 changed files with 6 additions and 0 deletions

View File

@ -1109,6 +1109,12 @@ ecore_x_randr_window_crtcs_get(Ecore_X_Window window, int *num)
XRRScreenResources *res = NULL;
Ecore_X_Randr_Crtc *ret = NULL;
if (ncrtcs <= 0)
{
free(crtcs);
return NULL;
}
/* make sure we can allocate our return variable */
if (!(ret = calloc(1, ncrtcs * sizeof(Ecore_X_Randr_Crtc))))
{