mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
StringUtil: Fix possible bad free
This commit is contained in:
@ -173,7 +173,11 @@ std::string StringFromFormatV(const char* format, va_list args)
|
|||||||
locale_t previousLocale = uselocale(GetCLocale());
|
locale_t previousLocale = uselocale(GetCLocale());
|
||||||
#endif
|
#endif
|
||||||
if (vasprintf(&buf, format, args) < 0)
|
if (vasprintf(&buf, format, args) < 0)
|
||||||
|
{
|
||||||
ERROR_LOG(COMMON, "Unable to allocate memory for string");
|
ERROR_LOG(COMMON, "Unable to allocate memory for string");
|
||||||
|
buf = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
#if !defined(ANDROID) && !defined(__HAIKU__) && !defined(__OpenBSD__)
|
#if !defined(ANDROID) && !defined(__HAIKU__) && !defined(__OpenBSD__)
|
||||||
uselocale(previousLocale);
|
uselocale(previousLocale);
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user