From: Florian Forster Date: Mon, 21 May 2007 05:21:28 +0000 (+0200) Subject: plugin.c: Added a comment that explains why the order of the linked list and callback... X-Git-Tag: collectd-4.0.0~7^2~4 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=36031828bab8e5a9a3494d94e49c6b4882cb32f3;p=collectd.git plugin.c: Added a comment that explains why the order of the linked list and callback are important. --- diff --git a/src/plugin.c b/src/plugin.c index 8087950e..da662040 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -607,6 +607,11 @@ void plugin_shutdown_all (void) while (le != NULL) { callback = (int (*) (void)) le->value; + + /* Advance the pointer before calling the callback allows + * shutdown functions to unregister themselves. If done the + * other way around the memory `le' points to will be freed + * after callback returns. */ le = le->next; (*callback) ();