Переглянути джерело

SDL_iconv_string: avoid memory leak if realloc() fails.

Ozkan Sezer 3 роки тому
батько
коміт
a2b13e585c
1 змінених файлів з 1 додано та 0 видалено
  1. 1 0
      src/stdlib/SDL_iconv.c

+ 1 - 0
src/stdlib/SDL_iconv.c

@@ -867,6 +867,7 @@ SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf,
                 stringsize *= 2;
                 string = (char *) SDL_realloc(string, stringsize);
                 if (!string) {
+                    SDL_free(oldstring);
                     SDL_iconv_close(cd);
                     return NULL;
                 }