talons

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

commit f21505305f6054677f80c18c7bd813623b947b29
parent 2dff9610ae15d24b734205e37578d2350368207a
Author: Ricardo Mones <ricardo@mones.org>
Date:   Sun,  9 Jun 2024 11:41:03 +0200

Fix CID 1591826: Resource leak

Diffstat:
Msrc/plugins/libravatar/libravatar_prefs.c | 16++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/plugins/libravatar/libravatar_prefs.c b/src/plugins/libravatar/libravatar_prefs.c @@ -142,18 +142,22 @@ static GtkWidget *labeled_spinner_box(gchar *label, GtkWidget *spinner, gchar *u static gchar *avatar_stats_label_markup(AvatarCacheStats *stats) { if (stats == NULL) - return g_strdup(g_strconcat("<span color=\"red\">", - _("Error reading cache stats"), "</span>", NULL)); + return g_markup_printf_escaped("<span color=\"red\">%s</span>", + _("Error reading cache stats")); - if (stats->errors > 0) - return g_markup_printf_escaped(g_strconcat("<span color=\"red\">", - _("Using %s in %d files, %d " - "directories, %d others and %d errors"), "</span>", NULL), + if (stats->errors > 0) { + gchar *label_text = g_strdup_printf(_("Using %s in %d files, %d " + "directories, %d others and %d errors"), to_human_readable((goffset) stats->bytes), stats->files, stats->dirs, stats->others, stats->errors); + gchar *label = g_markup_printf_escaped("<span color=\"red\">%s</span>", + label_text); + g_free(label_text); + return label; + } return g_strdup_printf( _("Using %s in %d files, %d directories and %d others"),