gnucash master: Avoid crash from trying to free an unallocated char*.

John Ralls jralls at code.gnucash.org
Sun Mar 19 13:09:40 EDT 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/0c3e8540 (commit)
	from  https://github.com/Gnucash/gnucash/commit/97f06532 (commit)



commit 0c3e85404d6547e1eb6ba1584fb58de62f30eddc
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Mar 19 10:09:01 2023 -0700

    Avoid crash from trying to free an unallocated char*.

diff --git a/libgnucash/app-utils/gnc-quotes.cpp b/libgnucash/app-utils/gnc-quotes.cpp
index 227a042a34..b0ea470c7a 100644
--- a/libgnucash/app-utils/gnc-quotes.cpp
+++ b/libgnucash/app-utils/gnc-quotes.cpp
@@ -180,7 +180,7 @@ m_version{}, m_sources{}, m_api_key{}
     if (!(av_key && *av_key))
     {
         g_free (av_key);
-        av_key = getenv("ALPHAVANTAGE_API_KEY");
+        av_key = g_strdup(getenv("ALPHAVANTAGE_API_KEY"));
     }
 
     if (av_key)



Summary of changes:
 libgnucash/app-utils/gnc-quotes.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



More information about the gnucash-changes mailing list