princeamd pushed a commit to branch ecore-1.7.

commit 613908e6de52f3f75adf54b8008f1dcf6f531c40
Author: Chris Michael <[email protected]>
Date:   Fri May 24 18:25:03 2013 +0100

    Backport: 1d58f5f :: Don't allocate space for a mode name unless the 
nameLength is greater than 0.
    
    Signed-off-by: Chris Michael <[email protected]>
    Signed-off-by: Deon Thomas <[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 d0bae16..076ccf6 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;
 

-- 

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

Reply via email to