summaryrefslogtreecommitdiff
path: root/src/lib/ecore_file
diff options
context:
space:
mode:
authorWooHyun Jung <wh0705.jung@samsung.com>2018-01-15 13:54:01 +0900
committerWooHyun Jung <wh0705.jung@samsung.com>2018-01-15 13:54:01 +0900
commit9fc1dd1a4ec8397977738732db1b5595cc51e182 (patch)
treef32f626dbfb043c5beeb5ca8a1e9796d02b0d7c9 /src/lib/ecore_file
parent487f2a5f81c4c05cc5cd30f7c3630f772623d0f8 (diff)
ecore_file_monitor: replace EINA_LIST_FOREACH to EINA_LIST_FOREACH_SAFE
If ecore_file_monitor_del is called inside the file monitor callback function, eina_list found from monitor_hash would be freed. (You can check this inside eina_hash_list_remove.) Then, EINA_LIST_FOREACH makes one more for loop with invalid eina_list pointer. EINA_LIST_FOREACH_SAFE can prevent from this problem.
Diffstat (limited to 'src/lib/ecore_file')
-rw-r--r--src/lib/ecore_file/ecore_file_monitor_inotify.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/ecore_file/ecore_file_monitor_inotify.c b/src/lib/ecore_file/ecore_file_monitor_inotify.c
index 7c8d5c9e79..cf04ae6ca8 100644
--- a/src/lib/ecore_file/ecore_file_monitor_inotify.c
+++ b/src/lib/ecore_file/ecore_file_monitor_inotify.c
@@ -153,7 +153,7 @@ ecore_file_monitor_backend_del(Ecore_File_Monitor *em)
153static Eina_Bool 153static Eina_Bool
154_ecore_file_monitor_inotify_handler(void *data EINA_UNUSED, Ecore_Fd_Handler *fdh) 154_ecore_file_monitor_inotify_handler(void *data EINA_UNUSED, Ecore_Fd_Handler *fdh)
155{ 155{
156 Eina_List *l, *ll; 156 Eina_List *l, *ll, *ll2;
157 Ecore_File_Monitor *em; 157 Ecore_File_Monitor *em;
158 char buffer[16384]; 158 char buffer[16384];
159 struct inotify_event *event; 159 struct inotify_event *event;
@@ -173,7 +173,7 @@ _ecore_file_monitor_inotify_handler(void *data EINA_UNUSED, Ecore_Fd_Handler *fd
173 i += event_size; 173 i += event_size;
174 174
175 l = _ecore_file_monitor_inotify_monitor_find(event->wd); 175 l = _ecore_file_monitor_inotify_monitor_find(event->wd);
176 EINA_LIST_FOREACH(l, ll, em) 176 EINA_LIST_FOREACH_SAFE(l, ll, ll2, em)
177 _ecore_file_monitor_inotify_events(em, (event->len ? event->name : NULL), event->mask); 177 _ecore_file_monitor_inotify_events(em, (event->len ? event->name : NULL), event->mask);
178 } 178 }
179 179