cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=205186da1627ab58f8ea7c1692749b5b1c5304e3
commit 205186da1627ab58f8ea7c1692749b5b1c5304e3 Author: Srivardhan Hebbar <[email protected]> Date: Tue Sep 22 00:06:02 2015 +0200 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 <[email protected]> Reviewers: stefan_schmidt, cedric Reviewed By: cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D3012 Signed-off-by: Cedric BAIL <[email protected]> --- src/lib/ecore_x/xcb/ecore_xcb_window.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/ecore_x/xcb/ecore_xcb_window.c b/src/lib/ecore_x/xcb/ecore_xcb_window.c index 47f5822..ce3e5ed 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_window.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_window.c @@ -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; } } --
