gnucash master: [c++options] Fix leak.

John Ralls jralls at code.gnucash.org
Sun Mar 5 13:14:46 EST 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/92071e88 (commit)
	from  https://github.com/Gnucash/gnucash/commit/abdd4d9e (commit)



commit 92071e88441afc5af412274dec921354c38608ee
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Mar 5 10:14:20 2023 -0800

    [c++options] Fix leak.

diff --git a/libgnucash/engine/gnc-optiondb.cpp b/libgnucash/engine/gnc-optiondb.cpp
index 98c98688f..5309ae7ac 100644
--- a/libgnucash/engine/gnc-optiondb.cpp
+++ b/libgnucash/engine/gnc-optiondb.cpp
@@ -1261,9 +1261,7 @@ const char*
 gnc_option_db_lookup_string_value(GncOptionDB* odb, const char* section, const char* name)
 {
     auto value{odb->lookup_string_option(section, name)};
-    if (value.empty())
-        return nullptr;
-    return strdup(value.c_str());
+    return value.empty() ? nullptr : strdup(value.c_str());
 }
 
 void



Summary of changes:
 libgnucash/engine/gnc-optiondb.cpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)



More information about the gnucash-changes mailing list