Skip to content

Commit

Permalink
Added three missing checks for return values of SDL_calloc().
Browse files Browse the repository at this point in the history
  • Loading branch information
philippwiesemann committed Dec 26, 2014
1 parent bbaaa77 commit d8c6034
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/video/emscripten/SDL_emscriptenmouse.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d8c6034

Please sign in to comment.