forked from enlightenment/efl
ecore_x: fixing memory leak on realloc.
Summary: If realloc fails, it returns NULL. Then whatever the memory the ignore_list was pointing to would be leaked. So freeing it now. Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com> Reviewers: stefan_schmidt, cedric Reviewed By: cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D3012 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
parent
abdbb9ad14
commit
205186da16
|
@ -1430,6 +1430,7 @@ ecore_x_window_ignore_set(Ecore_X_Window win,
|
|||
int ignore)
|
||||
{
|
||||
int i = 0, j = 0, count = 0;
|
||||
Ecore_X_Window *temp = ignore_list;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
CHECK_XCB_CONN;
|
||||
|
@ -1443,7 +1444,11 @@ ecore_x_window_ignore_set(Ecore_X_Window win,
|
|||
|
||||
ignore_list =
|
||||
realloc(ignore_list, (ignore_num + 1) * sizeof(Ecore_X_Window));
|
||||
if (!ignore_list) return;
|
||||
if (!ignore_list)
|
||||
{
|
||||
ignore_list = temp;
|
||||
return;
|
||||
}
|
||||
|
||||
ignore_list[ignore_num++] = win;
|
||||
}
|
||||
|
@ -1474,6 +1479,8 @@ ecore_x_window_ignore_set(Ecore_X_Window win,
|
|||
|
||||
ignore_list =
|
||||
realloc(ignore_list, ignore_num * sizeof(Ecore_X_Window));
|
||||
if (!ignore_list)
|
||||
ignore_list = temp;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue