mirror of https://github.com/mgba-emu/mgba.git
Util: Fix realloc semantics in utf16to8
This commit is contained in:
parent
f3d3c59df7
commit
f4dc546da6
1
CHANGES
1
CHANGES
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue