gnucash stable: [assistant-qif-import.c] fix gchar* leak

Christopher Lam clam at code.gnucash.org
Sun Sep 29 19:58:50 EDT 2024


Updated	 via  https://github.com/Gnucash/gnucash/commit/4b0c3506 (commit)
	from  https://github.com/Gnucash/gnucash/commit/654b6f7f (commit)



commit 4b0c3506a0137c6a4c34c817c646a94a82bd1b70
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Sep 27 23:07:20 2024 +0800

    [assistant-qif-import.c] fix gchar* leak
    
    and text doesn't need to be strdup'd

diff --git a/gnucash/import-export/qif-imp/assistant-qif-import.c b/gnucash/import-export/qif-imp/assistant-qif-import.c
index c91caa8845..cfe5949a07 100644
--- a/gnucash/import-export/qif-imp/assistant-qif-import.c
+++ b/gnucash/import-export/qif-imp/assistant-qif-import.c
@@ -3563,14 +3563,14 @@ gnc_ui_qif_import_summary_page_prepare (GtkAssistant *assistant,
                                         gpointer user_data)
 {
     QIFImportWindow * wind = user_data;
-    gchar *text;
 
-    if (wind->load_stop)
-        text = g_strdup_printf (_("There was a problem with the import."));
-    else
-        text = g_strdup_printf (_("QIF Import Completed."));
+    const gchar *msg = wind->load_stop ?
+        _("There was a problem with the import.") :
+        _("QIF Import Completed.");
+
+    gchar *text = g_markup_printf_escaped ("<span size=\"large\"><b>%s</b></span>", msg);
 
-    gtk_label_set_markup (GTK_LABEL(wind->summary_text), g_strdup_printf ("<span size=\"large\"><b>%s</b></span>", text));
+    gtk_label_set_markup (GTK_LABEL(wind->summary_text), text);
 
     g_free (text);
 



Summary of changes:
 gnucash/import-export/qif-imp/assistant-qif-import.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)



More information about the gnucash-changes mailing list