From cacdb12aa5a5429af8dd0eac67ea9acca896e879 Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Fri, 16 Jul 2021 09:41:21 +0100 Subject: [PATCH] Dereference the prices used in function convert_price The two prices used in convert_price had there reference count increased in extract_common_prices. This lead to the reference count continuously increasing and not being freed on close so add gnc_price_unref on both prices to reduce the reference count. --- libgnucash/engine/gnc-pricedb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libgnucash/engine/gnc-pricedb.c b/libgnucash/engine/gnc-pricedb.c index 1b15a5e08b..996945fd81 100644 --- a/libgnucash/engine/gnc-pricedb.c +++ b/libgnucash/engine/gnc-pricedb.c @@ -2488,6 +2488,9 @@ convert_price (const gnc_commodity *from, const gnc_commodity *to, PriceTuple tu price = gnc_numeric_div (to_val, from_val, GNC_DENOM_AUTO, no_round); + gnc_price_unref (tuple.from); + gnc_price_unref (tuple.to); + if (from_cur == from && to_cur == to) return price;