mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Prevent potential nullptr dereference.
Found by clang static analyzer.
This commit is contained in:
@@ -987,10 +987,13 @@ gncCustomerGetCachedBalance (GncCustomer *cust)
|
||||
|
||||
void gncCustomerSetCachedBalance (GncCustomer *cust, const gnc_numeric *new_bal)
|
||||
{
|
||||
if (!new_bal && cust->balance)
|
||||
if (!new_bal)
|
||||
{
|
||||
g_free (cust->balance);
|
||||
cust->balance = NULL;
|
||||
if (cust->balance)
|
||||
{
|
||||
g_free (cust->balance);
|
||||
cust->balance = NULL;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user