gnucash maint: QofQuery args must be destroyed after qof_query_merge

Christopher Lam clam at code.gnucash.org
Thu Sep 9 07:21:18 EDT 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/140922a3 (commit)
	from  https://github.com/Gnucash/gnucash/commit/d398a359 (commit)



commit 140922a37e451461e07c615f603fd3807fd4f724
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Wed Sep 8 23:59:24 2021 +0800

    QofQuery args must be destroyed after qof_query_merge
    
    qof_query_merge returns a new QofQuery; the two merged QofQueries are
    not explicitly destroyed.

diff --git a/bindings/guile/gnc-engine-guile.c b/bindings/guile/gnc-engine-guile.c
index 36915cd64..45a69ec24 100644
--- a/bindings/guile/gnc-engine-guile.c
+++ b/bindings/guile/gnc-engine-guile.c
@@ -1116,6 +1116,7 @@ gnc_scm2query_and_terms (SCM and_terms, query_version_t vers)
             if (q_and)
             {
                 q_new = qof_query_merge (q, q_and, QOF_QUERY_AND);
+                qof_query_destroy (q_and);
 
                 if (q_new)
                 {
@@ -1158,6 +1159,7 @@ gnc_scm2query_or_terms (SCM or_terms, query_version_t vers)
             if (q_or)
             {
                 q_new = qof_query_merge (q, q_or, QOF_QUERY_OR);
+                qof_query_destroy (q_or);
 
                 if (q_new)
                 {



Summary of changes:
 bindings/guile/gnc-engine-guile.c | 2 ++
 1 file changed, 2 insertions(+)



More information about the gnucash-changes mailing list