talons

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

commit 63db37ff1d65e6b294819c50c1487f7fd880da2c
parent 2e626bf179777336beccb385b817465bf64c4a34
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 @@ -1496,6 +1496,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; @@ -1574,6 +1575,7 @@ static MatcherProp *prefs_matcher_dialog_to_matcher(void) alertpanel_error(_("Invalid hour.")); return NULL; } + expr_to_free = TRUE; break; case CRITERIA_TEST: @@ -1684,6 +1686,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; } @@ -2165,14 +2170,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)