raster pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=878644970481e0ca14065f0391a87df2ef3d80f8
commit 878644970481e0ca14065f0391a87df2ef3d80f8 Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com> Date: Mon Jul 24 13:37:57 2017 +0900 efreetd cache create - fix reallocs to bail on out of memory cleanly --- src/bin/efreet/efreet_icon_cache_create.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/bin/efreet/efreet_icon_cache_create.c b/src/bin/efreet/efreet_icon_cache_create.c index 9cefc82dad..6fc709ff23 100644 --- a/src/bin/efreet/efreet_icon_cache_create.c +++ b/src/bin/efreet/efreet_icon_cache_create.c @@ -237,6 +237,7 @@ cache_scan_path_dir(Efreet_Icon_Theme *theme, Efreet_Cache_Icon *icon; char *name; char *ext; + const char **tmp; unsigned int i; if (entry->type == EINA_FILE_DIR) @@ -309,8 +310,16 @@ cache_scan_path_dir(Efreet_Icon_Theme *theme, */ else if (!strcmp(icon->theme, theme->name.internal)) { - icon->icons = realloc(icon->icons, - sizeof (Efreet_Cache_Icon_Element*) * (++icon->icons_count)); + Efreet_Cache_Icon_Element **tmp2; + + tmp2 = realloc(icon->icons, + sizeof(Efreet_Cache_Icon_Element *) * (++icon->icons_count)); + if (!tmp2) + { + ERR("Out of memory"); + exit(1); + } + icon->icons = tmp2; icon->icons[i] = NEW(Efreet_Cache_Icon_Element, 1); icon->icons[i]->type = dir->type; icon->icons[i]->normal = dir->size.normal; @@ -325,8 +334,14 @@ cache_scan_path_dir(Efreet_Icon_Theme *theme, } /* and finally store the path */ - icon->icons[i]->paths = realloc(icon->icons[i]->paths, - sizeof (char*) * (icon->icons[i]->paths_count + 1)); + tmp = realloc(icon->icons[i]->paths, + sizeof(char *) * (icon->icons[i]->paths_count + 1)); + if (!tmp) + { + ERR("Out of memory"); + exit(1); + } + icon->icons[i]->paths = tmp; icon->icons[i]->paths[icon->icons[i]->paths_count] = eina_stringshare_add(entry->path); eina_array_push(strs, icon->icons[i]->paths[icon->icons[i]->paths_count++]); } --