Util: Fix realloc semantics in utf16to8
Jeffrey Pfau jeffrey@endrift.com
Sun, 29 May 2016 09:57:10 -0700
2 files changed,
3 insertions(+),
1 deletions(-)
M
CHANGES
→
CHANGES
@@ -25,6 +25,7 @@ - Util: Fix socket bind addresses
- 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
M
src/util/string.c
→
src/util/string.c
@@ -202,8 +202,9 @@ }
} char* newUTF8 = realloc(utf8, utf8Length + 1); - if (newUTF8 != utf8) { + if (!newUTF8) { free(utf8); + return 0; } newUTF8[utf8Length] = '\0'; return newUTF8;