gnucash stable: [gsettings.cpp] g_settings_schema_unref after g_object_get

Christopher Lam clam at code.gnucash.org
Sat Jul 1 00:23:56 EDT 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/9dfe223f (commit)
	from  https://github.com/Gnucash/gnucash/commit/0d326fa1 (commit)



commit 9dfe223fc7303cd1a2eb7cbf4088dea9791667de
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Jun 25 00:55:27 2023 +0800

    [gsettings.cpp] g_settings_schema_unref after g_object_get
    
    g_object_get may be reffing the schema which prevents it freeing.

diff --git a/libgnucash/app-utils/gnc-gsettings.cpp b/libgnucash/app-utils/gnc-gsettings.cpp
index 864b2c6a31..df26a0576d 100644
--- a/libgnucash/app-utils/gnc-gsettings.cpp
+++ b/libgnucash/app-utils/gnc-gsettings.cpp
@@ -67,6 +67,7 @@ static bool gnc_gsettings_is_valid_key(GSettings *settings, const gchar *key)
     auto keys = g_settings_schema_list_keys (schema);
     auto found = (keys && g_strv_contains(keys, key));
     g_strfreev (keys);
+    g_settings_schema_unref (schema);
 
     return found;
 }
@@ -87,6 +88,7 @@ static GSettings * gnc_gsettings_get_settings_obj (const gchar *schema_str)
     g_free(full_name);
 
     LEAVE("");
+    g_settings_schema_unref (schema);
     return gset;
 }
 
@@ -472,6 +474,7 @@ gnc_gsettings_reset_schema (const gchar *schema_str)
     }
 
     g_object_unref (gs_obj);
+    g_settings_schema_unref (schema);
     g_strfreev (keys);
 }
 



Summary of changes:
 libgnucash/app-utils/gnc-gsettings.cpp | 3 +++
 1 file changed, 3 insertions(+)



More information about the gnucash-changes mailing list