This email list is read-only.  Emails sent to this list will be discarded
----------------------------------
 src/plugin.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 4a7178f181574f47eeea44249358595b2784c3fb
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Sat Oct 18 19:06:34 2008 +0200

    Simplify plugin descriptor checking

commit e3e56199f01eda60b6f2d54d4133137ef546314b
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Sat Oct 18 18:06:18 2008 +0200

    Fix memory leak when plugin init fails

commit 0889675fe72fdedfd0f8919084d80a550d6b3472
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Sat Oct 18 18:04:34 2008 +0200

    Handle plugin init errors


Diff in this email is a maximum of 400 lines.
diff --git a/src/plugin.c b/src/plugin.c
index 0d90fd9..c128505 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -40,6 +40,9 @@ static gboolean add_plugin(void *handle, struct 
connman_plugin_desc *desc)
 {
        struct connman_plugin *plugin;
 
+       if (desc->init == NULL)
+               return FALSE;
+
        plugin = g_try_new0(struct connman_plugin, 1);
        if (plugin == NULL)
                return FALSE;
@@ -47,9 +50,12 @@ static gboolean add_plugin(void *handle, struct 
connman_plugin_desc *desc)
        plugin->handle = handle;
        plugin->desc = desc;
 
-       plugins = g_slist_append(plugins, plugin);
+       if (desc->init() < 0) {
+               g_free(plugin);
+               return FALSE;
+       }
 
-       desc->init();
+       plugins = g_slist_append(plugins, plugin);
 
        return TRUE;
 }
@@ -91,11 +97,6 @@ int __connman_plugin_init(void)
                                continue;
                        }
 
-                       if (desc->init == NULL) {
-                               dlclose(handle);
-                               continue;
-                       }
-
                        if (add_plugin(handle, desc) == FALSE)
                                dlclose(handle);
                }
_______________________________________________
Commits mailing list
[email protected]
https://lists.moblin.org/mailman/listinfo/commits

Reply via email to