Added three missing checks for return values of SDL_calloc().
This commit is contained in:
parent
b7254055e9
commit
d0ca05bcdb
1 changed files with 14 additions and 0 deletions
|
@ -42,6 +42,11 @@ Emscripten_CreateDefaultCursor()
|
||||||
cursor = SDL_calloc(1, sizeof(SDL_Cursor));
|
cursor = SDL_calloc(1, sizeof(SDL_Cursor));
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
curdata = (Emscripten_CursorData *) SDL_calloc(1, sizeof(*curdata));
|
curdata = (Emscripten_CursorData *) SDL_calloc(1, sizeof(*curdata));
|
||||||
|
if (!curdata) {
|
||||||
|
SDL_OutOfMemory();
|
||||||
|
SDL_free(cursor);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
curdata->system_cursor = "default";
|
curdata->system_cursor = "default";
|
||||||
cursor->driverdata = curdata;
|
cursor->driverdata = curdata;
|
||||||
|
@ -108,7 +113,16 @@ Emscripten_CreateSystemCursor(SDL_SystemCursor id)
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor));
|
cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor));
|
||||||
|
if (!cursor) {
|
||||||
|
SDL_OutOfMemory();
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
curdata = (Emscripten_CursorData *) SDL_calloc(1, sizeof(*curdata));
|
curdata = (Emscripten_CursorData *) SDL_calloc(1, sizeof(*curdata));
|
||||||
|
if (!curdata) {
|
||||||
|
SDL_OutOfMemory();
|
||||||
|
SDL_free(cursor);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
curdata->system_cursor = cursor_name;
|
curdata->system_cursor = cursor_name;
|
||||||
cursor->driverdata = curdata;
|
cursor->driverdata = curdata;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue