gnucash maint: Bug 798754 - Build fails with gcc 13 and glib > 2.76

John Ralls jralls at code.gnucash.org
Thu Feb 23 12:53:13 EST 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/184669f5 (commit)
	from  https://github.com/Gnucash/gnucash/commit/b9c5416a (commit)



commit 184669f517744ac7be6e420e5e1f359384f676d5
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Feb 23 09:47:37 2023 -0800

    Bug 798754 - Build fails with gcc 13 and glib > 2.76
    
    GLib 2.76 introduced a no-discard warning on g_string_free
    if the second parameter is FALSE. This revealed a string
    leak and a correct usage that didn't use the return value.

diff --git a/libgnucash/gnc-module/gnc-module.c b/libgnucash/gnc-module/gnc-module.c
index f6ffcdf7d..bef690678 100644
--- a/libgnucash/gnc-module/gnc-module.c
+++ b/libgnucash/gnc-module/gnc-module.c
@@ -108,7 +108,7 @@ gnc_module_system_search_dirs(void)
             if (!escchar)
             {
                 list = g_list_append(list, token->str);
-                g_string_free(token, FALSE);
+                g_string_free(token, TRUE);
                 token = g_string_new(NULL);
             }
             else
@@ -126,8 +126,8 @@ gnc_module_system_search_dirs(void)
     }
     if (token->len)
     {
-        list = g_list_append(list, token->str);
-        g_string_free(token, FALSE);
+        char *token_str = g_string_free (token, FALSE);
+        list = g_list_append(list, token_str);
     }
     else
     {



Summary of changes:
 libgnucash/gnc-module/gnc-module.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)



More information about the gnucash-changes mailing list