talons

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

commit a102ba8a33d274aac3ebba966007c646fb14a8a1
parent e389d0d172652d1702a05a058165756253635237
Author: wwp <subscript@free.fr>
Date:   Thu, 30 Sep 2021 12:28:09 +0200

Fix CID 1491099 and 1491241: resource leaks.

Diffstat:
Msrc/gtk/about.c | 17+++++++++++------
Msrc/gtk/gtkaspell.c | 9+++++----
2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/gtk/about.c b/src/gtk/about.c @@ -99,6 +99,7 @@ static GtkWidget *about_create_child_page_info(void) #if HAVE_SYS_UTSNAME_H struct utsname utsbuf; #endif + gchar *format; scrolledwin = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin), @@ -169,32 +170,36 @@ static GtkWidget *about_create_child_page_info(void) #if HAVE_SYS_UTSNAME_H uname(&utsbuf); - g_snprintf(buf, sizeof(buf),g_strconcat( + format = g_strconcat( "GTK+ %d.%d.%d / GLib %d.%d.%d\n", _("Locale: %s (charset: %s)\n" - "Operating System: %s %s (%s)"), NULL), + "Operating System: %s %s (%s)"), NULL); + g_snprintf(buf, sizeof(buf), format, gtk_major_version, gtk_minor_version, gtk_micro_version, glib_major_version, glib_minor_version, glib_micro_version, conv_get_current_locale(), conv_get_locale_charset_str(), utsbuf.sysname, utsbuf.release, utsbuf.machine); #elif defined(G_OS_WIN32) - g_snprintf(buf, sizeof(buf),g_strconcat( + format = g_strconcat( "GTK+ %d.%d.%d / GLib %d.%d.%d\n", _("Locale: %s (charset: %s)\n" - "Operating System: %s"), NULL), + "Operating System: %s"), NULL); + g_snprintf(buf, sizeof(buf), format, gtk_major_version, gtk_minor_version, gtk_micro_version, glib_major_version, glib_minor_version, glib_micro_version, conv_get_current_locale(), conv_get_locale_charset_str(), "Win32"); #else - g_snprintf(buf, sizeof(buf),g_strconcat( + format = g_strconcat( "GTK+ %d.%d.%d / GLib %d.%d.%d\n", _("Locale: %s (charset: %s)\n" - "Operating System: unknown"), NULL), + "Operating System: unknown"), NULL); + g_snprintf(buf, sizeof(buf), format, gtk_major_version, gtk_minor_version, gtk_micro_version, glib_major_version, glib_minor_version, glib_micro_version, conv_get_current_locale(), conv_get_locale_charset_str()); #endif + g_free(format); gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, buf, -1, "indented-list-item", NULL); diff --git a/src/gtk/gtkaspell.c b/src/gtk/gtkaspell.c @@ -1432,7 +1432,7 @@ static void replace_with_create_dialog_cb(GtkWidget *w, gpointer data) GtkWidget *parent_window; GtkWidget *content_area; GtkWidget *action_area; - gchar *utf8buf, *thelabel; + gchar *utf8buf, *thelabel, *format; gint xx, yy; GtkAspell *gtkaspell = (GtkAspell *) data; @@ -1463,9 +1463,10 @@ static void replace_with_create_dialog_cb(GtkWidget *w, gpointer data) utf8buf = g_strdup(gtkaspell->theword); - thelabel = g_strdup_printf(g_strconcat("<span weight=\"bold\" size=\"larger\">", - _("Replace \"%s\" with: "), "</span>", NULL), - utf8buf); + format = g_strconcat("<span weight=\"bold\" size=\"larger\">", + _("Replace \"%s\" with: "), "</span>", NULL); + thelabel = g_strdup_printf(format, utf8buf); + g_free(format); icon = gtk_image_new_from_stock(GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);