Commit d8c60342cc7c976f1577f46eb1e659ef0216a0e2

Philipp Wiesemann 2014-12-26T20:11:28

Added three missing checks for return values of SDL_calloc().

diff --git a/src/video/emscripten/SDL_emscriptenmouse.c b/src/video/emscripten/SDL_emscriptenmouse.c
index 333f76e..2e46a0a 100644
--- a/src/video/emscripten/SDL_emscriptenmouse.c
+++ b/src/video/emscripten/SDL_emscriptenmouse.c
@@ -42,6 +42,11 @@ Emscripten_CreateDefaultCursor()
     cursor = SDL_calloc(1, sizeof(SDL_Cursor));
     if (cursor) {
         curdata = (Emscripten_CursorData *) SDL_calloc(1, sizeof(*curdata));
+        if (!curdata) {
+            SDL_OutOfMemory();
+            SDL_free(cursor);
+            return NULL;
+        }
 
         curdata->system_cursor = "default";
         cursor->driverdata = curdata;
@@ -108,7 +113,16 @@ Emscripten_CreateSystemCursor(SDL_SystemCursor id)
     }
 
     cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor));
+    if (!cursor) {
+        SDL_OutOfMemory();
+        return NULL;
+    }
     curdata = (Emscripten_CursorData *) SDL_calloc(1, sizeof(*curdata));
+    if (!curdata) {
+        SDL_OutOfMemory();
+        SDL_free(cursor);
+        return NULL;
+    }
 
     curdata->system_cursor = cursor_name;
     cursor->driverdata = curdata;