Code

plugin.c: Advance the llentry_t pointer before calling the shutdown callback.
authorSebastian Harl <sh@tokkee.org>
Sun, 20 May 2007 20:59:21 +0000 (22:59 +0200)
committerFlorian Forster <octo@huhu.verplant.org>
Mon, 21 May 2007 05:17:48 +0000 (07:17 +0200)
> 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 <sh@tokkee.org>
src/plugin.c

index 36cd80af61e7a9c9976465e9fdedd8928e4895c8..8087950ea85987a76b1f750c2a449e2fa5b27899 100644 (file)
@@ -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 */