gnucash maint: [dialog-search] another QofQuery "q" must be destroyed

Christopher Lam clam at code.gnucash.org
Thu Nov 18 18:36:59 EST 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/27683f21 (commit)
	from  https://github.com/Gnucash/gnucash/commit/74d594d1 (commit)



commit 27683f212df9d111fbee039f75ee139ad27e8b24
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Nov 19 00:02:48 2021 +0800

    [dialog-search] another QofQuery "q" must be destroyed
    
    because qof_query_merge creates a newly allocated QofQuery, its 2
    QofQuery must be freed separately.

diff --git a/gnucash/gnome-search/dialog-search.c b/gnucash/gnome-search/dialog-search.c
index 82501bcfc..a7f1bdc32 100644
--- a/gnucash/gnome-search/dialog-search.c
+++ b/gnucash/gnome-search/dialog-search.c
@@ -478,8 +478,10 @@ search_update_query (GNCSearchWindow *sw)
         if (pdata)
         {
             q2 = create_query_fragment(sw->search_for, GNC_SEARCH_PARAM (data->param), pdata);
-            q = qof_query_merge (q, q2, op);
+            new_q = qof_query_merge (q, q2, op);
+            qof_query_destroy (q);
             qof_query_destroy (q2);
+            q = new_q;
         }
     }
 



Summary of changes:
 gnucash/gnome-search/dialog-search.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list