Commit 86fb92a7da6c0121c3c932bc7e6e887691102aa9

Philipp Wiesemann 2015-04-15T21:25:15

Emscripten: Fixed memory leak if SDL_GetPrefPath() failed.

1
2
3
4
5
6
7
8
9
10
11
12
diff --git a/src/filesystem/emscripten/SDL_sysfilesystem.c b/src/filesystem/emscripten/SDL_sysfilesystem.c
index f5ea789..02471d3 100644
--- a/src/filesystem/emscripten/SDL_sysfilesystem.c
+++ b/src/filesystem/emscripten/SDL_sysfilesystem.c
@@ -57,6 +57,7 @@ SDL_GetPrefPath(const char *org, const char *app)
 
     if (mkdir(retval, 0700) != 0 && errno != EEXIST) {
         SDL_SetError("Couldn't create directory '%s': '%s'", retval, strerror(errno));
+        SDL_free(retval);
         return NULL;
     }