From: Sebastian Harl Date: Sun, 20 May 2007 20:59:21 +0000 (+0200) Subject: plugin.c: Advance the llentry_t pointer before calling the shutdown callback. X-Git-Tag: collectd-4.0.0~7^2~5 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=deb839e18f64fedaa8e789ee6bd8619de957ea65;p=collectd.git plugin.c: Advance the llentry_t pointer before calling the shutdown callback. > Important note: Unregistering the shutdown callback during shutdown is > somewhat tricky. Doing that frees the llist_t entry in plugin.c:list_shutdown. > This might cause a segfault in plugin_shutdown_all () when it tries to access > the next pointer of that entry. If plugin_unregister_shutdown () is the last > statement before the return from the shutdown callback this should be save in > about 99% of all cases. Still there should be some better way to handle this. This is an imho nice way to fix it. Signed-off-by: Sebastian Harl --- diff --git a/src/plugin.c b/src/plugin.c index 36cd80af..8087950e 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -607,9 +607,9 @@ void plugin_shutdown_all (void) while (le != NULL) { callback = (int (*) (void)) le->value; - (*callback) (); - le = le->next; + + (*callback) (); } } /* void plugin_shutdown_all */