devilhorns pushed a commit to branch master.

commit f287fd33a77a081a606e8737ed4d041f253e3630
Author: Chris Michael <[email protected]>
Date:   Thu Jul 25 12:32:49 2013 +0100

    Trap for number of crtcs < 1 so we do not try to allocate space for
    zero crtcs.
    
    Signed-off-by: Chris Michael <[email protected]>
---
 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 ef1ea40..8ba1692 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))))
           {

-- 

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk

Reply via email to