talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 2c9090652293247cbe8b9e4fe163c5582dab51ac
parent 0c35d74035d32b7486a044609aa3d3b1ff877e3f
Author: wwp <subscript@free.fr>
Date:   Thu, 30 Sep 2021 11:42:47 +0200

Fix CID 1491210: resource leak.

Diffstat:
Msrc/common/template.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/common/template.c b/src/common/template.c @@ -156,11 +156,8 @@ static gint tmpl_compare(gconstpointer tmpl1, gconstpointer tmpl2) GSList *template_read_config(void) { const gchar *path; - gchar *filename; GDir *dir; const gchar *dir_name; - GStatBuf s; - Template *tmpl; GSList *tmpl_list = NULL; path = get_template_dir(); @@ -178,12 +175,15 @@ GSList *template_read_config(void) } while ((dir_name = g_dir_read_name(dir)) != NULL) { - filename = g_strconcat(path, G_DIR_SEPARATOR_S, + Template *tmpl; + GStatBuf s; + gchar *filename = filename = g_strconcat(path, G_DIR_SEPARATOR_S, dir_name, NULL); if (g_stat(filename, &s) != 0 || !S_ISREG(s.st_mode) ) { debug_print("%s:%d %s is not an ordinary file\n", __FILE__, __LINE__, filename); + g_free(filename); continue; }