devilhorns pushed a commit to branch master.
commit 551610fa417cc84d70ef38a355f2bb5a3a92b476
Author: Chris Michael <[email protected]>
Date: Thu Jul 25 13:09:34 2013 +0100
Guard against allocating 0 outputs and 0 possible outputs.
Signed-off-by: Chris Michael <[email protected]>
---
src/lib/ecore_x/xlib/ecore_x_randr.c | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/src/lib/ecore_x/xlib/ecore_x_randr.c
b/src/lib/ecore_x/xlib/ecore_x_randr.c
index 235cf48..b1fd9d6 100644
--- a/src/lib/ecore_x/xlib/ecore_x_randr.c
+++ b/src/lib/ecore_x/xlib/ecore_x_randr.c
@@ -1890,24 +1890,30 @@ ecore_x_randr_crtc_info_get(Ecore_X_Window root, const
Ecore_X_Randr_Crtc crtc)
ret->noutput = info->noutput;
ret->npossible = info->npossible;
- if ((ret->outputs =
- malloc(info->noutput * sizeof(Ecore_X_Randr_Output))))
+ if (input->noutput > 0)
{
- int i = 0;
+ if ((ret->outputs =
+ malloc(info->noutput *
sizeof(Ecore_X_Randr_Output))))
+ {
+ int i = 0;
- /* loop the outputs on this crtc */
- for (i = 0; i < info->noutput; i++)
- ret->outputs[i] = info->outputs[i];
+ /* loop the outputs on this crtc */
+ for (i = 0; i < info->noutput; i++)
+ ret->outputs[i] = info->outputs[i];
+ }
}
- if ((ret->possible =
- malloc(info->npossible * sizeof(Ecore_X_Randr_Output))))
+ if (info->npossible > 0)
{
- int i = 0;
+ if ((ret->possible =
+ malloc(info->npossible *
sizeof(Ecore_X_Randr_Output))))
+ {
+ int i = 0;
- /* loop the outputs on this crtc */
- for (i = 0; i < info->npossible; i++)
- ret->possible[i] = info->possible[i];
+ /* loop the outputs on this crtc */
+ for (i = 0; i < info->npossible; i++)
+ ret->possible[i] = info->possible[i];
+ }
}
}
--
------------------------------------------------------------------------------
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