[Commits] [SCM] claws branch, gtk3, updated. 4.0.0-243-g104cf039b
wwp at claws-mail.org
wwp at claws-mail.org
Tue Sep 28 14:37:17 CEST 2021
The branch, gtk3 has been updated
via 104cf039b750ae9f7d401cb7e0288a31776aa1cd (commit)
from c1de20451a1983aa3b9979464046933a88f79124 (commit)
Summary of changes:
src/plugins/spamassassin/spamassassin.c | 96 +++++++++++++++++----------------
1 file changed, 50 insertions(+), 46 deletions(-)
- Log -----------------------------------------------------------------
commit 104cf039b750ae9f7d401cb7e0288a31776aa1cd
Author: wwp <subscript at free.fr>
Date: Tue Sep 28 14:36:55 2021 +0200
Fix CID 1491076 and 1491352: resource leaks.
diff --git a/src/plugins/spamassassin/spamassassin.c b/src/plugins/spamassassin/spamassassin.c
index 8409b7adf..99ac93339 100644
--- a/src/plugins/spamassassin/spamassassin.c
+++ b/src/plugins/spamassassin/spamassassin.c
@@ -1,6 +1,6 @@
/*
* Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 the Claws Mail Team
+ * Copyright (C) 1999-2021 the Claws Mail Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -418,6 +418,7 @@ int spamassassin_learn(MsgInfo *msginfo, GSList *msglist, gboolean spam)
return -1;
}
+ /* process *either* a msginfo or a msglist */
if (msginfo) {
file = procmsg_get_message_file(msginfo);
if (file == NULL) {
@@ -435,53 +436,55 @@ int spamassassin_learn(MsgInfo *msginfo, GSList *msglist, gboolean spam)
prefs_common_get_prefs()->work_offline?" -L":"",
spam?"--spam":"--ham", file);
}
- }
- if (msglist) {
- GSList *cur = msglist;
- MsgInfo *info;
-
- if (config.transport == SPAMASSASSIN_TRANSPORT_TCP) {
- /* execute n-times the spamc command */
- for (; cur; cur = cur->next) {
- info = (MsgInfo *)cur->data;
- gchar *tmpcmd = NULL;
- gchar *tmpfile = get_tmp_file();
-
- if (spamc_wrapper == NULL) {
- spamc_wrapper = spamassassin_create_tmp_spamc_wrapper(spam);
- }
+ } else {
+ if (msglist) {
+ GSList *cur = msglist;
+ MsgInfo *info;
+
+ if (config.transport == SPAMASSASSIN_TRANSPORT_TCP) {
+ /* execute n-times the spamc command */
+ for (; cur; cur = cur->next) {
+ info = (MsgInfo *)cur->data;
+ gchar *tmpcmd = NULL;
+ gchar *tmpfile = get_tmp_file();
+
+ if (spamc_wrapper == NULL) {
+ spamc_wrapper = spamassassin_create_tmp_spamc_wrapper(spam);
+ }
- if (spamc_wrapper && tmpfile &&
- copy_file(procmsg_get_message_file(info), tmpfile, TRUE) == 0) {
- tmpcmd = g_strconcat(shell?shell:"sh", " ", spamc_wrapper, " ",
- tmpfile, NULL);
- debug_print("%s\n", tmpcmd);
- execute_command_line(tmpcmd, FALSE, NULL);
- g_free(tmpcmd);
+ if (spamc_wrapper && tmpfile &&
+ copy_file(procmsg_get_message_file(info), tmpfile, TRUE) == 0) {
+ tmpcmd = g_strconcat(shell?shell:"sh", " ", spamc_wrapper, " ",
+ tmpfile, NULL);
+ debug_print("%s\n", tmpcmd);
+ execute_command_line(tmpcmd, FALSE, NULL);
+ g_free(tmpcmd);
+ }
+ g_free(tmpfile);
}
- g_free(tmpfile);
- }
- g_free(spamc_wrapper);
- return 0;
- } else {
- cmd = g_strdup_printf("sa-learn -u %s%s %s",
- config.username,
- prefs_common_get_prefs()->work_offline?" -L":"",
- spam?"--spam":"--ham");
-
- /* concatenate all message tmpfiles to the sa-learn command-line */
- for (; cur; cur = cur->next) {
- info = (MsgInfo *)cur->data;
- gchar *tmpcmd = NULL;
- gchar *tmpfile = get_tmp_file();
-
- if (tmpfile &&
- copy_file(procmsg_get_message_file(info), tmpfile, TRUE) == 0) {
- tmpcmd = g_strconcat(cmd, " ", tmpfile, NULL);
- g_free(cmd);
- cmd = tmpcmd;
+ if (spamc_wrapper)
+ g_free(spamc_wrapper);
+ return 0;
+ } else {
+ cmd = g_strdup_printf("sa-learn -u %s%s %s",
+ config.username,
+ prefs_common_get_prefs()->work_offline?" -L":"",
+ spam?"--spam":"--ham");
+
+ /* concatenate all message tmpfiles to the sa-learn command-line */
+ for (; cur; cur = cur->next) {
+ info = (MsgInfo *)cur->data;
+ gchar *tmpcmd = NULL;
+ gchar *tmpfile = get_tmp_file();
+
+ if (tmpfile &&
+ copy_file(procmsg_get_message_file(info), tmpfile, TRUE) == 0) {
+ tmpcmd = g_strconcat(cmd, " ", tmpfile, NULL);
+ g_free(cmd);
+ cmd = tmpcmd;
+ }
+ g_free(tmpfile);
}
- g_free(tmpfile);
}
}
}
@@ -492,7 +495,8 @@ int spamassassin_learn(MsgInfo *msginfo, GSList *msglist, gboolean spam)
/* only run sync calls to sa-learn/spamc to prevent system lockdown */
execute_command_line(cmd, FALSE, NULL);
g_free(cmd);
- g_free(spamc_wrapper);
+ if (spamc_wrapper)
+ g_free(spamc_wrapper);
return 0;
}
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list