cedric pushed a commit to branch master.

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

commit 84127a89637838c19c44bab7c215e60552c1a93e
Author: Srivardhan Hebbar <sri.heb...@samsung.com>
Date:   Thu Oct 8 12:20:46 2015 +0200

    ecore_xcb: handle realloc failure.
    
    Summary:
    If realloc fails, then lst would be NULL, so assigning lst[i] only if 
realloc is successful, else assigning lst to previous memory location.
    
    Signed-off-by: Srivardhan Hebbar <sri.heb...@samsung.com>
    
    Reviewers: cedric
    
    Reviewed By: cedric
    
    Subscribers: cedric
    
    Differential Revision: https://phab.enlightenment.org/D3155
    
    Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 src/lib/ecore_x/xcb/ecore_xcb_window_prop.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/lib/ecore_x/xcb/ecore_xcb_window_prop.c 
b/src/lib/ecore_x/xcb/ecore_xcb_window_prop.c
index 85db1eb..d3a049b 100644
--- a/src/lib/ecore_x/xcb/ecore_xcb_window_prop.c
+++ b/src/lib/ecore_x/xcb/ecore_xcb_window_prop.c
@@ -518,7 +518,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 = 0, num = 0;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
@@ -545,8 +545,12 @@ ecore_x_window_prop_xid_list_change(Ecore_X_Window win,
         if (op == ECORE_X_PROP_LIST_REMOVE)
           goto done;
         num++;
+        temp = lst;
         lst = realloc(lst, num * sizeof(Ecore_X_ID));
-        lst[i] = item;
+        if (lst)
+           lst[i] = item;
+        else
+           lst = temp;
      }
    ecore_x_window_prop_xid_set(win, atom, type, lst, num);
 

-- 


Reply via email to