gnucash maint: [gnc-module.c] free a GList* properly

Christopher Lam clam at code.gnucash.org
Tue Aug 24 10:32:56 EDT 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/9ddb9e82 (commit)
	from  https://github.com/Gnucash/gnucash/commit/38327657 (commit)



commit 9ddb9e821550c28647b54d5c4de3ee5c84acebb8
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Tue Aug 24 22:31:37 2021 +0800

    [gnc-module.c] free a GList* properly
    
    g_list_free (current) was a NOP because current became NULL after the
    preceding GList traversal.

diff --git a/libgnucash/gnc-module/gnc-module.c b/libgnucash/gnc-module/gnc-module.c
index 638b1318b..11465757e 100644
--- a/libgnucash/gnc-module/gnc-module.c
+++ b/libgnucash/gnc-module/gnc-module.c
@@ -257,11 +257,7 @@ gnc_module_system_refresh(void)
 
     }
     /* free the search dir strings */
-    for (current = search_dirs; current; current = current->next)
-    {
-        g_free(current->data);
-    }
-    g_list_free(current);
+    g_list_free_full (search_dirs, g_free);
 }
 
 



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



More information about the gnucash-changes mailing list