Skip to content

Commit

Permalink
Merge pull request #5290 from neomonkey/master
Browse files Browse the repository at this point in the history
StringUtil: Fix possible bad free
  • Loading branch information
leoetlino committed Mar 26, 2018
2 parents 793c6d2 + 7169be2 commit c55b3a6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Source/Core/Common/StringUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@ std::string StringFromFormatV(const char* format, va_list args)
locale_t previousLocale = uselocale(GetCLocale());
#endif
if (vasprintf(&buf, format, args) < 0)
{
ERROR_LOG(COMMON, "Unable to allocate memory for string");
buf = nullptr;
}

#if !defined(ANDROID) && !defined(__HAIKU__) && !defined(__OpenBSD__)
uselocale(previousLocale);
#endif
Expand Down

0 comments on commit c55b3a6

Please sign in to comment.