Skip to content

Commit

Permalink
[c++options] Fix leak.
Browse files Browse the repository at this point in the history
  • Loading branch information
jralls committed Mar 5, 2023
1 parent abdd4d9 commit 92071e8
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions libgnucash/engine/gnc-optiondb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 92071e8

Please sign in to comment.