r22644 - gnucash/trunk/src/gnome-utils - Don't leak a GNCPrice after fetching prices from finance-quote.
Mike Alexander
mta at code.gnucash.org
Thu Dec 13 00:13:34 EST 2012
Author: mta
Date: 2012-12-13 00:13:34 -0500 (Thu, 13 Dec 2012)
New Revision: 22644
Trac: http://svn.gnucash.org/trac/changeset/22644
Modified:
gnucash/trunk/src/gnome-utils/dialog-transfer.c
Log:
Don't leak a GNCPrice after fetching prices from finance-quote.
Modified: gnucash/trunk/src/gnome-utils/dialog-transfer.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-transfer.c 2012-12-12 17:43:29 UTC (rev 22643)
+++ gnucash/trunk/src/gnome-utils/dialog-transfer.c 2012-12-13 05:13:34 UTC (rev 22644)
@@ -1680,11 +1680,15 @@
scm_call_2 (quotes_func, scm_window, book_scm);
gnc_unset_busy_cursor (NULL);
- /*the results should be in the price db now */
+ /*the results should be in the price db now, but don't crash if not. */
prc = gnc_pricedb_lookup_latest(xferData->pricedb, from, to);
- rate = gnc_price_get_value (prc);
- gnc_amount_edit_set_amount(GNC_AMOUNT_EDIT(xferData->price_edit), rate);
+ if (prc)
+ {
+ rate = gnc_price_get_value (prc);
+ gnc_amount_edit_set_amount(GNC_AMOUNT_EDIT(xferData->price_edit), rate);
+ gnc_price_unref (prc);
+ }
LEAVE("quote retrieved");
More information about the gnucash-changes
mailing list