From 888676eb31d0a942d1ee12dec4bd3767517d2bcb Mon Sep 17 00:00:00 2001 From: Hong Xu Date: Thu, 29 Apr 2021 14:49:16 -0700 Subject: [PATCH] from_price and to_price may be uninitialized in extract_comon_prices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix the compilation error on gcc 10: gnucash/libgnucash/engine/gnc-pricedb.c: In function ‘extract_common_prices’: gnucash/libgnucash/engine/gnc-pricedb.c:2469:40: error: to_price may be used uninitialized in this function [-Werror=maybe-uninitialized] 2469 | if (from_price == NULL || to_price == NULL) | ^ gnucash/libgnucash/engine/gnc-pricedb.c:2469:20: error: ‘from_price’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 2469 | if (from_price == NULL || to_price == NULL) | ^ --- libgnucash/engine/gnc-pricedb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgnucash/engine/gnc-pricedb.c b/libgnucash/engine/gnc-pricedb.c index fb3d59869e..e8686b49fd 100644 --- a/libgnucash/engine/gnc-pricedb.c +++ b/libgnucash/engine/gnc-pricedb.c @@ -2439,7 +2439,7 @@ extract_common_prices (PriceList *from_prices, PriceList *to_prices, { PriceTuple retval = {NULL, NULL}; GList *from_node = NULL, *to_node = NULL; - GNCPrice *from_price, *to_price; + GNCPrice *from_price = NULL, *to_price = NULL; for (from_node = from_prices; from_node != NULL; from_node = g_list_next(from_node))