Page MenuHomePhabricator

eina_mempool: eina_mempool_malloc always creates same pointer.
Open, HighPublic


If the same pointers are freed twice by eina_mempool_free, newly created pointers by eina_mempool_malloc are always same.
Because eina_mempool uses eina_trash_push and eina_trash_pop.
I attached sample code.

Actually, problem case is that the same ecore_idler is deleted twice by user fault.
In this case, we can defend using efl_event_callback_array_del's return value.
I wonder if there is way to solve this problem at eina_mempool side.

void *                                                                                    
_ecore_factorized_idle_del(Ecore_Idler *idler)                                            
   Eina_Bool ret = efl_event_callback_array_del(_mainloop_singleton, idler->desc, idler); 
   if (!ret) return idler->data;                                           
   data = idler->data;                                                                    
   eina_mempool_free(idler_mp, idler);                                                    
   return data;                                                                           
eagleeye triaged this task as High priority.May 14 2020, 3:16 AM