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.hebbar@samsung.com>
Reviewers: cedric
Reviewed By: cedric
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D3155
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Ecore_X_ID item,
int op)
{
- Ecore_X_ID *lst;
+ Ecore_X_ID *lst, *temp;
int i = 0, num = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
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);