all repos — mgba @ 3cc715f116b3e72ed464a36508f2b5032a1a97e9

mGBA Game Boy Advance Emulator

Util: Fix realloc semantics in utf16to8
Jeffrey Pfau jeffrey@endrift.com
Sun, 29 May 2016 09:57:10 -0700
commit

3cc715f116b3e72ed464a36508f2b5032a1a97e9

parent

2655e45f44f32bd6dd03b067de375bca4ed2dd27

2 files changed, 3 insertions(+), 1 deletions(-)

jump to
M CHANGESCHANGES

@@ -20,6 +20,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.csrc/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;