Util: Fix realloc semantics in utf16to8

This commit is contained in:
Jeffrey Pfau 2016-05-29 09:57:10 -07:00
parent f3d3c59df7
commit f4dc546da6
2 changed files with 3 additions and 1 deletions

View File

@ -25,6 +25,7 @@ Bugfixes:
- All: Fix instruction tables getting zeroed when linking sometimes
- SDL: Fix SDL 1.2 build
- ARM7: Fix flags on SBC/RSC
- Util: Fix realloc semantics in utf16to8
Misc:
- GBA: Slightly optimize GBAProcessEvents
- Qt: Add preset for DualShock 4

View File

@ -202,8 +202,9 @@ char* utf16to8(const uint16_t* utf16, size_t length) {
}
char* newUTF8 = realloc(utf8, utf8Length + 1);
if (newUTF8 != utf8) {
if (!newUTF8) {
free(utf8);
return 0;
}
newUTF8[utf8Length] = '\0';
return newUTF8;