Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

Commit

Permalink
core: protect against callbacks removing themsevles in nebmods (Andre…
Browse files Browse the repository at this point in the history
…as Ericsson) #1021

fixes #1021
  • Loading branch information
Michael Friedrich committed Nov 24, 2010
1 parent ac600a4 commit 373cb33
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changelog
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion base/nebmods.c
Expand Up @@ -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);
Expand Down

0 comments on commit 373cb33

Please sign in to comment.