Fixed mismatch between stdlib calloc() and SDL free()

Fixes https://github.com/libsdl-org/SDL/issues/8145
This commit is contained in:
Sam Lantinga
2023-08-23 14:48:44 -07:00
parent fb79211732
commit 845f3c7450

View File

@@ -23,6 +23,7 @@
/* #pragma push_macro/pop_macro works correctly only as of gcc >= 4.4.3
clang-3.0 _seems_ to be OK. */
#pragma push_macro("calloc")
#pragma push_macro("malloc")
#pragma push_macro("realloc")
#pragma push_macro("free")
@@ -38,6 +39,7 @@
#pragma push_macro("tolower")
#pragma push_macro("wcsdup")
#undef calloc
#undef malloc
#undef realloc
#undef free
@@ -53,6 +55,7 @@
#undef tolower
#undef wcsdup
#define calloc SDL_calloc
#define malloc SDL_malloc
#define realloc SDL_realloc
#define free SDL_free
@@ -106,6 +109,7 @@ static int SDL_libusb_get_string_descriptor(libusb_device_handle *dev,
#undef ICONV_CONST
#undef UNDEF_ICONV_CONST
#endif
#pragma pop_macro("calloc")
#pragma pop_macro("malloc")
#pragma pop_macro("realloc")
#pragma pop_macro("free")