exec plugin: Change the input format so it's identical to the one used in unixsock.
[collectd.git] / src / plugin.c
index 36cd80a..da66204 100644 (file)
@@ -607,9 +607,14 @@ void plugin_shutdown_all (void)
        while (le != NULL)
        {
                callback = (int (*) (void)) le->value;
-               (*callback) ();
 
+               /* 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) ();
        }
 } /* void plugin_shutdown_all */