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.
This commit is contained in:
John Ralls 2023-02-23 09:47:37 -08:00
parent b9c5416a00
commit 184669f517

View File

@ -108,7 +108,7 @@ gnc_module_system_search_dirs(void)
if (!escchar) if (!escchar)
{ {
list = g_list_append(list, token->str); list = g_list_append(list, token->str);
g_string_free(token, FALSE); g_string_free(token, TRUE);
token = g_string_new(NULL); token = g_string_new(NULL);
} }
else else
@ -126,8 +126,8 @@ gnc_module_system_search_dirs(void)
} }
if (token->len) if (token->len)
{ {
list = g_list_append(list, token->str); char *token_str = g_string_free (token, FALSE);
g_string_free(token, FALSE); list = g_list_append(list, token_str);
} }
else else
{ {