# HG changeset patch # User Mark Doliner # Date 1238144940 0 # Node ID a28827fdea16830f5216ed6ee5114ae4ac9a6cf8 # Parent fd5dfd3c04b5ef2b968ee8e4ef30312a9dc7f763 Free some memory if we exit early due to an error. Thanks to Mayank Jain Nawal's email to the devel list for pointing this out. Oh, and I didn't test these changes at all... I guess I probably should. diff -r fd5dfd3c04b5 -r a28827fdea16 libpurple/plugins/mono/loader/mono.c --- a/libpurple/plugins/mono/loader/mono.c Fri Mar 27 09:02:22 2009 +0000 +++ b/libpurple/plugins/mono/loader/mono.c Fri Mar 27 09:09:00 2009 +0000 @@ -44,11 +44,11 @@ purple_debug(PURPLE_DEBUG_INFO, "mono", "Probing plugin\n"); if (ml_is_api_dll(mono_assembly_get_image(assm))) { - purple_debug(PURPLE_DEBUG_INFO, "mono", "Found our PurpleAPI.dll\n"); + purple_debug_info("mono", "Found our PurpleAPI.dll\n"); + mono_assembly_close(assm); return FALSE; } - info = g_new0(PurplePluginInfo, 1); mplug = g_new0(PurpleMonoPlugin, 1); mplug->signal_data = NULL; @@ -58,12 +58,16 @@ mplug->klass = ml_find_plugin_class(mono_assembly_get_image(mplug->assm)); if (!mplug->klass) { purple_debug(PURPLE_DEBUG_ERROR, "mono", "no plugin class in \'%s\'\n", file); + mono_assembly_close(assm); + g_free(mplug); return FALSE; } mplug->obj = mono_object_new(ml_get_domain(), mplug->klass); if (!mplug->obj) { purple_debug(PURPLE_DEBUG_ERROR, "mono", "obj not valid\n"); + mono_assembly_close(assm); + g_free(mplug); return FALSE; } @@ -85,6 +89,8 @@ if (!(found_load && found_unload && found_destroy)) { purple_debug(PURPLE_DEBUG_ERROR, "mono", "did not find the required methods\n"); + mono_assembly_close(assm); + g_free(mplug); return FALSE; } @@ -93,6 +99,7 @@ /* now that the methods are filled out we can populate the info struct with all the needed info */ + info = g_new0(PurplePluginInfo, 1); info->id = ml_get_prop_string(plugin_info, "Id"); info->name = ml_get_prop_string(plugin_info, "Name"); info->version = ml_get_prop_string(plugin_info, "Version");