From c3fff8a8a733187a469a5db2c0cac23eb8847325 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 7 Nov 2011 22:28:05 +0000 Subject: [PATCH] fix possible null deref here SVN revision: 64882 --- src/bin/e_fm_op_registry.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/src/bin/e_fm_op_registry.c b/src/bin/e_fm_op_registry.c index f66c3294a..b7f78e233 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; + if (eina_inlist_count(e->listeners) < 1) return; - shadow = alloca(sizeof(*shadow) * count); - - i = 0; - EINA_INLIST_FOREACH(e->listeners, l) - shadow[i++] = l; - - 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