mirror of https://github.com/libsdl-org/SDL.git
Noticed this in SDL-1.2 where gcc-13 emits a -Wuse-after-free warning.
No such warning in SDL2 and SDL3, because unlike SDL1.2, SDL_realloc()
is not a macro expanding to libc realloc(). It warns, of course, if
SDL_realloc() is replaced with plain realloc():
src/stdlib/SDL_iconv.c: In function 'SDL_iconv_string_REAL':
src/stdlib/SDL_iconv.c:824:39: warning: pointer 'oldstring' may be used after 'realloc' [-Wuse-after-free]
824 | outbuf = string + (outbuf - oldstring);
| ~~~~~~~~^~~~~~~~~~~~
src/stdlib/SDL_iconv.c:818:30: note: call to 'realloc' here
818 | string = (char *)realloc(string, stringsize + sizeof(Uint32));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||
|---|---|---|
| .. | ||
| SDL_casefolding.h | ||
| SDL_crc16.c | ||
| SDL_crc32.c | ||
| SDL_getenv.c | ||
| SDL_iconv.c | ||
| SDL_malloc.c | ||
| SDL_memcpy.c | ||
| SDL_memmove.c | ||
| SDL_memset.c | ||
| SDL_mslibc.c | ||
| SDL_mslibc_x64.masm | ||
| SDL_qsort.c | ||
| SDL_stdlib.c | ||
| SDL_string.c | ||
| SDL_strtokr.c | ||
| SDL_sysstdlib.h | ||
| SDL_vacopy.h | ||