devilhorns pushed a commit to branch master.
commit 1d58f5ff1dbe27de782755b8eafaef44227824d7
Author: Chris Michael <[email protected]>
Date: Fri May 24 18:25:03 2013 +0100
Don't allocate space for a mode name unless the nameLength is greater
than 0.
Signed-off-by: Chris Michael <[email protected]>
---
src/lib/ecore_x/xlib/ecore_x_randr.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/lib/ecore_x/xlib/ecore_x_randr.c
b/src/lib/ecore_x/xlib/ecore_x_randr.c
index b2c8807..f9178ca 100644
--- a/src/lib/ecore_x/xlib/ecore_x_randr.c
+++ b/src/lib/ecore_x/xlib/ecore_x_randr.c
@@ -713,10 +713,15 @@ ecore_x_randr_modes_info_get(Ecore_X_Window root, int
*num)
ret[i]->vSyncStart = res->modes[i].vSyncStart;
ret[i]->vSyncEnd = res->modes[i].vSyncEnd;
ret[i]->vTotal = res->modes[i].vTotal;
- if ((ret[i]->name =
- (malloc(res->modes[i].nameLength + 1))))
- strncpy(ret[i]->name, res->modes[i].name,
- (res->modes[i].nameLength + 1));
+ if (res->modes[i].nameLength > 0)
+ {
+ if ((ret[i]->name =
+ (malloc(res->modes[i].nameLength + 1))))
+ strncpy(ret[i]->name, res->modes[i].name,
+ (res->modes[i].nameLength + 1));
+ else
+ ret[i]->name = NULL;
+ }
else
ret[i]->name = NULL;
--
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may