Summary:
Found this with a quick valgrind session. For paths that are not directories, if we fail the `ecore_file_is_dir` condition memory will not be freed.
The change is to use the default e_path freeing function.
Test Plan:
Run enlightenment in valgrind. It should no longer show a mem leak like below.
```
==6912== 8 bytes in 1 blocks are definitely lost in loss record 186 of 5,940
==6912== at 0x4C28C50: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6912== by 0x4D8574: e_path_dir_list_get (e_path.c:326)
==6912== by 0x4D1BA4: e_module_init.part.0 (e_module.c:183)
==6912== by 0x4D1DA8: e_module_init (e_module.c:153)
==6912== by 0x4371ED: main (e_main.c:868)
```
Reviewers: zmike
Subscribers: cedric, seoz
Differential Revision: https://phab.enlightenment.org/D3356
e_module_init(void)
{
Eina_List *module_paths;
+ Eina_List *next_path;
E_Path_Dir *epd;
Eio_Monitor *mon;
Eio_File *ls;
}
}
module_paths = e_path_dir_list_get(path_modules);
- EINA_LIST_FREE(module_paths, epd)
+ EINA_LIST_FOREACH(module_paths, next_path, epd)
{
if (ecore_file_is_dir(epd->dir))
{
ls = eio_file_direct_ls(epd->dir, _module_filter_cb, _module_main_cb, _module_done_cb, _module_error_cb, data);
_e_module_path_monitors = eina_list_append(_e_module_path_monitors, mon);
_e_module_path_lists = eina_list_append(_e_module_path_lists, ls);
- eina_stringshare_del(epd->dir);
- free(epd);
}
}
+ e_path_dir_list_free(module_paths);
return 1;
}