mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-18 09:18:14 +00:00
SDL_iconv_string: avoid memory leak if realloc() fails.
This commit is contained in:
@@ -867,6 +867,7 @@ SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf,
|
|||||||
stringsize *= 2;
|
stringsize *= 2;
|
||||||
string = (char *) SDL_realloc(string, stringsize);
|
string = (char *) SDL_realloc(string, stringsize);
|
||||||
if (!string) {
|
if (!string) {
|
||||||
|
SDL_free(oldstring);
|
||||||
SDL_iconv_close(cd);
|
SDL_iconv_close(cd);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user