woohyun pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=9fc1dd1a4ec8397977738732db1b5595cc51e182

commit 9fc1dd1a4ec8397977738732db1b5595cc51e182
Author: WooHyun Jung <[email protected]>
Date:   Mon Jan 15 13:54:01 2018 +0900

    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.
---
 src/lib/ecore_file/ecore_file_monitor_inotify.c | 4 ++--
 1 file 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)
 static Eina_Bool
 _ecore_file_monitor_inotify_handler(void *data EINA_UNUSED, Ecore_Fd_Handler 
*fdh)
 {
-   Eina_List *l, *ll;
+   Eina_List *l, *ll, *ll2;
    Ecore_File_Monitor *em;
    char buffer[16384];
    struct inotify_event *event;
@@ -173,7 +173,7 @@ _ecore_file_monitor_inotify_handler(void *data EINA_UNUSED, 
Ecore_Fd_Handler *fd
         i += event_size;
 
         l = _ecore_file_monitor_inotify_monitor_find(event->wd);
-        EINA_LIST_FOREACH(l, ll, em)
+        EINA_LIST_FOREACH_SAFE(l, ll, ll2, em)
           _ecore_file_monitor_inotify_events(em, (event->len ? event->name : 
NULL), event->mask);
      }
 

-- 


Reply via email to