From: Mike Blumenkrantz Date: Mon, 7 Nov 2011 22:28:05 +0000 (+0000) Subject: fix possible null deref here X-Git-Tag: submit/efl/20131021.015651~5441 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c3fff8a8a733187a469a5db2c0cac23eb8847325;p=platform%2Fupstream%2Fenlightenment.git fix possible null deref here SVN revision: 64882 --- diff --git a/src/bin/e_fm_op_registry.c b/src/bin/e_fm_op_registry.c index f66c329..b7f78e2 100644 --- a/src/bin/e_fm_op_registry.c +++ b/src/bin/e_fm_op_registry.c @@ -103,26 +103,14 @@ _e_fm2_op_registry_entry_internal_ref(E_Fm2_Op_Registry_Entry_Internal *e) static void _e_fm2_op_registry_entry_listeners_call(const E_Fm2_Op_Registry_Entry_Internal *e) { - E_Fm2_Op_Registry_Entry_Listener *l, **shadow; + E_Fm2_Op_Registry_Entry_Listener *listener; + Eina_Inlist *l; const E_Fm2_Op_Registry_Entry *entry; - unsigned int i, count; - - /* NB: iterate on a copy in order to allow listeners to be deleted - * from callbacks. number of listeners should be small, so the - * following should do fine. - */ - count = eina_inlist_count(e->listeners); - if (count < 1) return; - shadow = alloca(sizeof(*shadow) * count); - - i = 0; - EINA_INLIST_FOREACH(e->listeners, l) - shadow[i++] = l; + if (eina_inlist_count(e->listeners) < 1) return; - entry = &(e->entry); - for (i = 0; i < count; i++) - shadow[i]->cb(shadow[i]->data, entry); + EINA_INLIST_FOREACH_SAFE(e->listeners, l, listener) + listener->cb(listener->data, &e->entry); } static void