mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
fix for core dump
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@1154 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
0036179ecc
commit
a5902d581f
@ -72,16 +72,18 @@ xaccQuerySetAccounts (Query *q, Account **list)
|
||||
int i=0;
|
||||
Account *acc;
|
||||
|
||||
if (!q || !list) return;
|
||||
if (!q) return;
|
||||
q->changed = 1;
|
||||
|
||||
if (q->acc_list) free (q->acc_list);
|
||||
q->acc_list = NULL;
|
||||
if (!list) return;
|
||||
|
||||
/* copy in the account list */
|
||||
i=0; acc = list[0];
|
||||
while (acc) {
|
||||
i++; acc = list[i];
|
||||
}
|
||||
|
||||
if (q->acc_list) free (q->acc_list);
|
||||
|
||||
q->acc_list = (Account **) _malloc ( (i+1) * sizeof (Account *));
|
||||
|
||||
i=0; acc = list[0];
|
||||
@ -115,16 +117,18 @@ xaccQueryAddAccount (Query *q, Account *addme)
|
||||
|
||||
q->acc_list = (Account **) _malloc ( (i+2) * sizeof (Account *));
|
||||
|
||||
i=0; acc = oldlist[0];
|
||||
while (acc) {
|
||||
q->acc_list[i] = acc;
|
||||
i++; acc = oldlist[i];
|
||||
}
|
||||
i=0;
|
||||
if (oldlist) {
|
||||
acc = oldlist[0];
|
||||
while (acc) {
|
||||
q->acc_list[i] = acc;
|
||||
i++; acc = oldlist[i];
|
||||
}
|
||||
free (oldlist);
|
||||
}
|
||||
q->acc_list[i] = addme;
|
||||
i++;
|
||||
q->acc_list[i] = NULL;
|
||||
|
||||
if (oldlist) free (oldlist);
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
Loading…
Reference in New Issue
Block a user