]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Unload plugins in reverse order
authorMartin Willi <martin@revosec.ch>
Thu, 15 Jul 2010 12:05:02 +0000 (14:05 +0200)
committerMartin Willi <martin@revosec.ch>
Wed, 4 Aug 2010 07:26:20 +0000 (09:26 +0200)
src/libstrongswan/plugins/plugin_loader.c

index 336d0bc0245f86d831dee5c28b27658c577de8d3..e1427bf1502e74a3a32b7499a264011b36d9bf7d 100644 (file)
@@ -189,7 +189,6 @@ static bool load(private_plugin_loader_t *this, char *path, char *list)
                plugin = load_plugin(this, path, token);
                if (plugin)
                {
-                       /* insert in front to destroy them in reverse order */
                        this->plugins->insert_last(this->plugins, plugin);
                        this->names->insert_last(this->names, token);
                }
@@ -215,12 +214,13 @@ static void unload(private_plugin_loader_t *this)
        plugin_t *plugin;
        char *name;
 
-       while (this->plugins->remove_first(this->plugins,
+       /* unload plugins in reverse order */
+       while (this->plugins->remove_last(this->plugins,
                                                                           (void**)&plugin) == SUCCESS)
        {
                plugin->destroy(plugin);
        }
-       while (this->names->remove_first(this->names, (void**)&name) == SUCCESS)
+       while (this->names->remove_last(this->names, (void**)&name) == SUCCESS)
        {
                free(name);
        }