From f287fd33a77a081a606e8737ed4d041f253e3630 Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Thu, 25 Jul 2013 12:32:49 +0100 Subject: [PATCH] Trap for number of crtcs < 1 so we do not try to allocate space for zero crtcs. Signed-off-by: Chris Michael --- src/lib/ecore_x/xlib/ecore_x_randr.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/ecore_x/xlib/ecore_x_randr.c b/src/lib/ecore_x/xlib/ecore_x_randr.c index ef1ea40521..8ba1692f51 100644 --- a/src/lib/ecore_x/xlib/ecore_x_randr.c +++ b/src/lib/ecore_x/xlib/ecore_x_randr.c @@ -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)))) {