devilhorns pushed a commit to branch master.

commit 8aef3fa98a1ac218a3f69ae14dc938c6ba0c9707
Author: Chris Michael <[email protected]>
Date:   Thu Jul 25 13:08:18 2013 +0100

    Guard against trying to allocate 0 outputs.
    
    Signed-off-by: Chris Michael <[email protected]>
---
 src/lib/ecore_x/xlib/ecore_x_randr.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/lib/ecore_x/xlib/ecore_x_randr.c 
b/src/lib/ecore_x/xlib/ecore_x_randr.c
index 8ba1692..235cf48 100644
--- a/src/lib/ecore_x/xlib/ecore_x_randr.c
+++ b/src/lib/ecore_x/xlib/ecore_x_randr.c
@@ -1109,7 +1109,7 @@ ecore_x_randr_window_crtcs_get(Ecore_X_Window window, int 
*num)
         XRRScreenResources *res = NULL;
         Ecore_X_Randr_Crtc *ret = NULL;
 
-        if (ncrtcs <= 0)
+        if (ncrtcs < 1)
           {
              free(crtcs);
              return NULL;
@@ -1695,10 +1695,13 @@ ecore_x_randr_crtc_settings_set(Ecore_X_Window root, 
Ecore_X_Randr_Crtc crtc, Ec
         if (noutputs < 0)
           {
              noutputs = info->noutput;
-             routputs = malloc(noutputs * sizeof(RROutput));
-             for (i = 0; i < noutputs; i++)
-               routputs[i] = info->outputs[i];
-             need_free = EINA_TRUE;
+             if (noutputs > 0)
+               {
+                  routputs = malloc(noutputs * sizeof(RROutput));
+                  for (i = 0; i < noutputs; i++)
+                    routputs[i] = info->outputs[i];
+                  need_free = EINA_TRUE;
+               }
           }
         else if (noutputs > 0)
           {

-- 

------------------------------------------------------------------------------
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