From fae07ec3f1c1b0674ef85ae181d55a8a24cf8532 Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Tue, 8 Jan 2002 01:37:10 +0000 Subject: [PATCH] fix mem leaks git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6531 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/engine/Query.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/engine/Query.c b/src/engine/Query.c index 848cb378f6..9888c013b8 100644 --- a/src/engine/Query.c +++ b/src/engine/Query.c @@ -316,6 +316,7 @@ xaccInitQuery(Query * q, QueryTerm * initial_term) q->terms = or; q->split_list = NULL; + q->xtn_list = NULL; q->changed = 1; q->max_splits = -1; @@ -606,6 +607,9 @@ xaccFreeQueryMembers(Query *q) g_list_free(q->split_list); q->split_list = NULL; + + g_list_free(q->xtn_list); + q->xtn_list = NULL; } void @@ -641,6 +645,7 @@ xaccQueryCopy(Query *q) copy->changed = q->changed; copy->split_list = g_list_copy (q->split_list); + copy->xtn_list = g_list_copy (q->xtn_list); return copy; } @@ -739,14 +744,16 @@ xaccQueryMerge(Query * q1, Query * q2, QueryOp op) retval->terms = g_list_concat(copy_or_terms(q1->terms), copy_or_terms(q2->terms)); retval->max_splits = q1->max_splits; - retval->split_list = NULL; /* fixme */ + retval->split_list = NULL; + retval->xtn_list = NULL; retval->changed = 1; break; case QUERY_AND: retval = xaccMallocQuery(); retval->max_splits = q1->max_splits; - retval->split_list = NULL; /* fixme */ + retval->split_list = NULL; + retval->xtn_list = NULL; retval->changed = 1; for(i=q1->terms; i; i=i->next) @@ -1488,7 +1495,7 @@ xaccQueryGetTransactions (Query * q, query_run_t runtype) Transaction * trans = NULL; gpointer val = NULL; int count = 0; - + /* iterate over matching splits, incrementing a match-count in * the hash table */ for(current = splits; current; current=current->next) { @@ -1516,8 +1523,10 @@ xaccQueryGetTransactions (Query * q, query_run_t runtype) /* ATM we rerun the xtn filter every time. Need to add checks and * updates for using cached results. */ q->last_run_type = runtype; + + g_list_free (q->xtn_list); q->xtn_list = retval; - + g_hash_table_destroy(trans_hash); return retval;