all repos — mgba @ f4dc546da68a757b6e8c04a379583909902f3628

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

f4dc546da68a757b6e8c04a379583909902f3628

parent

f3d3c59df7dccf6afcf353c37de96f14c192584e

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

jump to
M CHANGESCHANGES

@@ -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.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;