[Commits] [SCM] claws branch, master, updated. 3.18.0-113-gfa8b9e14d
wwp at claws-mail.org
wwp at claws-mail.org
Sun Sep 12 13:41:54 CEST 2021
The branch, master has been updated
via fa8b9e14d9f3452e48737ef1170858407f1b3226 (commit)
from eba430d7ae598ce1ab77a5da727d3d98dd6c0073 (commit)
Summary of changes:
src/main.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
- Log -----------------------------------------------------------------
commit fa8b9e14d9f3452e48737ef1170858407f1b3226
Author: wwp <subscript at free.fr>
Date: Sun Sep 12 13:40:06 2021 +0200
Fix CID 1491070: resource leak. Use a static GString to feed cmd.mailto
instead of a dynamically allocated struct that will never be freed.
diff --git a/src/main.c b/src/main.c
index 2baaf8f11..97acdc2e4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1837,10 +1837,9 @@ static void exit_claws(MainWindow *mainwin)
exit(1); \
}
-static GString * parse_cmd_compose_from_file(const gchar *fn)
+static void parse_cmd_compose_from_file(const gchar *fn, GString *body)
{
GString *headers = g_string_new(NULL);
- GString *body = g_string_new(NULL);
gchar *to = NULL;
gchar *h;
gchar *v;
@@ -1897,8 +1896,6 @@ static GString * parse_cmd_compose_from_file(const gchar *fn)
/* append the remaining headers */
g_string_append(body, headers->str);
g_string_free(headers, TRUE);
-
- return body;
}
#undef G_PRINT_EXIT
@@ -1915,6 +1912,8 @@ static void parse_cmd_opt_error(char *errstr, char* optstr)
exit(1);
}
+static GString mailto; /* used to feed cmd.compose_mailto when --compose-from-file is used */
+
static void parse_cmd_opt(int argc, char *argv[])
{
AttachInfo *ainfo;
@@ -1933,9 +1932,9 @@ static void parse_cmd_opt(int argc, char *argv[])
if (i+1 < argc) {
const gchar *p = argv[i+1];
- GString *mailto = parse_cmd_compose_from_file(p);
+ parse_cmd_compose_from_file(p, &mailto);
cmd.compose = TRUE;
- cmd.compose_mailto = mailto->str;
+ cmd.compose_mailto = mailto.str;
i++;
} else {
parse_cmd_opt_error(_("Missing file argument for option %s"), argv[i]);
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list