cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=c406cf79e1d2ab3ee2f28828d14fda3c513d1814

commit c406cf79e1d2ab3ee2f28828d14fda3c513d1814
Author: Srivardhan Hebbar <sri.heb...@samsung.com>
Date:   Mon Oct 19 11:21:22 2015 -0700

    ecore_x: handling realloc failure.
    
    Summary:
    If realloc fails, lst would be NULL. So handling it.
    Signed-off-by: Srivardhan Hebbar <sri.heb...@samsung.com>
    
    Reviewers: cedric
    
    Differential Revision: https://phab.enlightenment.org/D3182
    
    Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 src/lib/ecore_x/xlib/ecore_x_window_prop.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/lib/ecore_x/xlib/ecore_x_window_prop.c 
b/src/lib/ecore_x/xlib/ecore_x_window_prop.c
index 151f65a..043e50e 100644
--- a/src/lib/ecore_x/xlib/ecore_x_window_prop.c
+++ b/src/lib/ecore_x/xlib/ecore_x_window_prop.c
@@ -285,7 +285,7 @@ ecore_x_window_prop_xid_list_change(Ecore_X_Window win,
                                     Ecore_X_ID item,
                                     int op)
 {
-   Ecore_X_ID *lst;
+   Ecore_X_ID *lst, *temp;
    int i, num;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
@@ -319,8 +319,18 @@ ecore_x_window_prop_xid_list_change(Ecore_X_Window win,
           goto done;  /* Add it */
 
         num++;
+
+        temp = lst;
         lst = realloc(lst, num * sizeof(Ecore_X_ID));
-        lst[i] = item;
+        if (lst)
+          {
+             lst[i] = item;
+          }
+        else
+          {
+             lst = temp;
+             num--;
+          }
      }
 
    ecore_x_window_prop_xid_set(win, atom, type, lst, num);

-- 


Reply via email to