From eff81a92e9a3d2485bb0b616d0b8ba202fa62f21 Mon Sep 17 00:00:00 2001 From: Thomas Porzelt Date: Sun, 4 Oct 2009 16:58:31 +0200 Subject: [PATCH] [core] Don't increase refcount for module when specified multiple times in config --- src/main/plugin_core.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/plugin_core.c b/src/main/plugin_core.c index 2c9a368..3caecd0 100644 --- a/src/main/plugin_core.c +++ b/src/main/plugin_core.c @@ -545,7 +545,9 @@ static gboolean core_workers(liServer *srv, liPlugin* p, liValue *val) { } static gboolean core_module_load(liServer *srv, liPlugin* p, liValue *val) { + GString *name; liValue *mods = li_value_new_list(); + UNUSED(p); if (!g_module_supported()) { @@ -577,7 +579,12 @@ static gboolean core_module_load(liServer *srv, liPlugin* p, liValue *val) { /* parameter types ok, load modules */ for (guint i = 0; i < mods->data.list->len; i++) { - GString *name = g_array_index(mods->data.list, liValue*, i)->data.string; + name = g_array_index(mods->data.list, liValue*, i)->data.string; + if (li_module_lookup(srv->modules, name->str)) { + DEBUG(srv, "module_load: module '%s' already loaded", name->str); + continue; + } + if (!li_module_load(srv->modules, name->str)) { ERROR(srv, "could not load module '%s': %s", name->str, g_module_error()); li_value_free(mods);