[Commits] [SCM] claws branch, master, updated. 3.18.0-182-g6f04e9aa6
wwp at claws-mail.org
wwp at claws-mail.org
Mon Sep 27 21:01:34 CEST 2021
The branch, master has been updated
via 6f04e9aa652ef2028d2cc4fb07f928bbbfbdc6b5 (commit)
from a70d4584780ac40c71b5745b72c8a6e9d6aa964e (commit)
Summary of changes:
src/common/plugin.c | 34 +++++++++++++++++++++++++++-------
1 file changed, 27 insertions(+), 7 deletions(-)
- Log -----------------------------------------------------------------
commit 6f04e9aa652ef2028d2cc4fb07f928bbbfbdc6b5
Author: wwp <subscript at free.fr>
Date: Mon Sep 27 21:01:23 2021 +0200
Fix CID 1491185, 1492198, 1491356, 1491339, 1491307, 1491188, 1491179, 1491107: resource leaks.
diff --git a/src/common/plugin.c b/src/common/plugin.c
index 39679e817..578096c40 100644
--- a/src/common/plugin.c
+++ b/src/common/plugin.c
@@ -154,6 +154,7 @@ void plugin_save_list(void)
(prefs_set_block_label(pfile, block) < 0)) {
g_warning("failed to write plugin list");
g_free(rcpath);
+ g_free(block);
return;
}
g_free(block);
@@ -472,8 +473,10 @@ init_plugin:
!g_module_symbol(plugin->module, "plugin_provides", (gpointer)&plugin_provides) ||
!g_module_symbol(plugin->module, "plugin_init", (gpointer)&plugin_init)) {
*error = g_strdup(g_module_error());
- if (plugin->unloaded_hidden)
+ if (plugin->unloaded_hidden) {
+ g_free(plugin);
return NULL;
+ }
g_module_close(plugin->module);
g_free(plugin);
return NULL;
@@ -481,8 +484,10 @@ init_plugin:
if (plugin_licence_check(plugin_licence()) != TRUE) {
*error = g_strdup(_("This module is not licensed under a GPL v3 or later compatible license."));
- if (plugin->unloaded_hidden)
+ if (plugin->unloaded_hidden) {
+ g_free(plugin);
return NULL;
+ }
g_module_close(plugin->module);
g_free(plugin);
return NULL;
@@ -490,16 +495,20 @@ init_plugin:
if (!strcmp(plugin_type(), "GTK")) {
*error = g_strdup(_("This module is for Claws Mail GTK1."));
- if (plugin->unloaded_hidden)
+ if (plugin->unloaded_hidden) {
+ g_free(plugin);
return NULL;
+ }
g_module_close(plugin->module);
g_free(plugin);
return NULL;
}
if ((*error = plugin_check_features(plugin_provides())) != NULL) {
- if (plugin->unloaded_hidden)
+ if (plugin->unloaded_hidden) {
+ g_free(plugin);
return NULL;
+ }
g_module_close(plugin->module);
g_free(plugin);
return NULL;
@@ -583,7 +592,9 @@ static void replace_old_plugin_name(gchar *plugin_name)
strncpy(plugin_name + offset, new_name_end, strlen(old_name_end) - 1);
debug_print(" to %s\n", plugin_name);
+ g_free(new_name_end);
}
+ g_free(old_name_end);
}
void plugin_load_all(const gchar *type)
@@ -600,6 +611,7 @@ void plugin_load_all(const gchar *type)
if ((pfile = prefs_read_open(rcpath)) == NULL ||
(prefs_set_block_label(pfile, block) < 0)) {
g_free(rcpath);
+ g_free(block);
if (pfile)
prefs_file_close(pfile);
return;
@@ -607,16 +619,20 @@ void plugin_load_all(const gchar *type)
g_free(block);
while (claws_fgets(buf, sizeof(buf), pfile->fp) != NULL) {
+ Plugin *plugin = NULL;
+
if (buf[0] == '[')
break;
g_strstrip(buf);
replace_old_plugin_name(buf);
- if ((buf[0] != '\0') && (plugin_load(buf, &error) == NULL)) {
+ if ((buf[0] != '\0') && ((plugin = plugin_load(buf, &error)) == NULL)) {
g_warning("plugin loading error: %s", error);
g_free(error);
- }
+ }
+ if (plugin)
+ g_free(plugin);
}
prefs_file_close(pfile);
@@ -673,6 +689,8 @@ void plugin_load_standard_plugins (void)
break;
}
if (!cur) { /* Not yet loaded. */
+ Plugin *plugin = NULL;
+
/* FIXME: get_plugin_dir () returns with a trailing
* (back)slash; this should be fixed so that we can use
* g_module_build_path here. */
@@ -684,7 +702,9 @@ void plugin_load_standard_plugins (void)
names[i], ".", G_MODULE_SUFFIX, NULL);
#endif
error = NULL;
- plugin_load(filename, &error);
+ plugin = plugin_load(filename, &error);
+ if (plugin)
+ g_free(plugin);
g_free (error);
g_free(filename);
}
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list