mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Fix/extend r17039 and make gnc_commodity_find_currency() free its temporary data.
BP git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@17040 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
28d380651a
commit
ecff4858c2
@ -215,6 +215,7 @@ static gnc_commodity *
|
|||||||
gnc_commodity_find_currency (QofBook *book, xmlNodePtr tree)
|
gnc_commodity_find_currency (QofBook *book, xmlNodePtr tree)
|
||||||
{
|
{
|
||||||
gnc_commodity_table * table;
|
gnc_commodity_table * table;
|
||||||
|
gnc_commodity *currency = NULL;
|
||||||
gchar *exchange = NULL, *mnemonic = NULL;
|
gchar *exchange = NULL, *mnemonic = NULL;
|
||||||
xmlNodePtr node;
|
xmlNodePtr node;
|
||||||
|
|
||||||
@ -226,22 +227,20 @@ gnc_commodity_find_currency (QofBook *book, xmlNodePtr tree)
|
|||||||
mnemonic = (gchar*) xmlNodeGetContent (node->xmlChildrenNode);
|
mnemonic = (gchar*) xmlNodeGetContent (node->xmlChildrenNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!exchange || !mnemonic)
|
if (exchange
|
||||||
|
&& gnc_commodity_namespace_is_iso(exchange)
|
||||||
|
&& mnemonic)
|
||||||
{
|
{
|
||||||
if (exchange) xmlFree(exchange);
|
table = gnc_commodity_table_get_table(book);
|
||||||
if (mnemonic) xmlFree(mnemonic);
|
currency = gnc_commodity_table_lookup(table, exchange, mnemonic);
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gnc_commodity_namespace_is_iso(exchange))
|
if (exchange)
|
||||||
{
|
|
||||||
xmlFree(exchange);
|
xmlFree(exchange);
|
||||||
|
if (mnemonic)
|
||||||
xmlFree(mnemonic);
|
xmlFree(mnemonic);
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
table = gnc_commodity_table_get_table(book);
|
return currency;
|
||||||
return gnc_commodity_table_lookup(table, exchange, mnemonic);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
Loading…
Reference in New Issue
Block a user