talons

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

commit e1d431c550f6540a888e156a23db97b7450858ca
parent 8dde5e6b4bd5b052ec2bf9bc12d7ca9714143cd5
Author: wwp <subscript@free.fr>
Date:   Sun, 26 Sep 2021 21:04:34 +0200

Fix CID 1491134, 1491173: resource leaks.

Diffstat:
Msrc/prefs_matcher.c | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/prefs_matcher.c b/src/prefs_matcher.c @@ -1500,6 +1500,7 @@ static MatcherProp *prefs_matcher_dialog_to_matcher(void) gboolean case_sensitive; const gchar *header; const gchar *expr; + gboolean expr_to_free = FALSE; gint value, sel; gint year, month, day, hour, minute; @@ -1578,6 +1579,7 @@ static MatcherProp *prefs_matcher_dialog_to_matcher(void) alertpanel_error(_("Invalid hour.")); return NULL; } + expr_to_free = TRUE; break; case CRITERIA_TEST: @@ -1689,6 +1691,9 @@ static MatcherProp *prefs_matcher_dialog_to_matcher(void) matcherprop = matcherprop_new(criteria, header, matchtype, expr, value); + if (expr_to_free) + g_free(expr); + return matcherprop; } @@ -2170,14 +2175,15 @@ static void prefs_matcher_ok(void) ALERTFOCUS_SECOND); if (G_ALERTDEFAULT != val) { g_free(matcher_str); - g_free(str); + g_free(str); + matcherlist_free(matchers); return; } } g_free(matcher_str); } } - g_free(str); + g_free(str); gtk_widget_hide(matcher.window); gtk_window_set_modal(GTK_WINDOW(matcher.window), FALSE); if (matchers_callback != NULL)