diff --git a/Changelog b/Changelog index 91340eb79..4a9af77e3 100644 --- a/Changelog +++ b/Changelog @@ -27,6 +27,7 @@ FIXES * core: fix problem with extra whitespace in command definition and ePN (Jason Young) #918 * core: fix NOTIFICATIONTYPE MACRO never became CUSTOM (Alexey Dvoryanchikov) #950 * core: only catch SIGSEGV if we're not dumping core and running as a daemon #457 +* core: protect against callbacks removing themsevles in nebmods (Andreas Ericsson) #1021 * classic ui: change servicestatus letter color to default black, not grey #946 * classic ui: fix waste of cpu in status summary (TomTom) #933 diff --git a/base/nebmods.c b/base/nebmods.c index 137c9cf4f..9f2980077 100644 --- a/base/nebmods.c +++ b/base/nebmods.c @@ -575,12 +575,13 @@ int neb_make_callbacks(int callback_type, void *data){ log_debug_info(DEBUGL_EVENTBROKER,1,"Making callbacks (type %d)...\n",callback_type); /* make the callbacks... */ - for(temp_callback=neb_callback_list[callback_type];temp_callback!=NULL;temp_callback=next_callback){ + for(temp_callback=neb_callback_list[callback_type];temp_callback;temp_callback=next_callback){ /* Save temp_callback->next because if the callback function de-registers itself temp_callback's */ /* pointer isn't guaranteed to be usable anymore (neb_deregister_callback will free() it) */ next_callback=temp_callback->next; callbackfunc=temp_callback->callback_func; cbresult=callbackfunc(callback_type,data); + temp_callback = next_callback; total_callbacks++; log_debug_info(DEBUGL_EVENTBROKER,2,"Callback #%d (type %d) return code = %d\n",total_callbacks,callback_type,cbresult);