src/video/emscripten/SDL_emscriptenmouse.c
changeset 9298 98279bdf2230
parent 9278 8900afb78a19
child 9619 b94b6d0bff0f
     1.1 --- a/src/video/emscripten/SDL_emscriptenmouse.c	Wed Dec 24 11:33:42 2014 -0500
     1.2 +++ b/src/video/emscripten/SDL_emscriptenmouse.c	Fri Dec 26 20:11:28 2014 +0100
     1.3 @@ -42,6 +42,11 @@
     1.4      cursor = SDL_calloc(1, sizeof(SDL_Cursor));
     1.5      if (cursor) {
     1.6          curdata = (Emscripten_CursorData *) SDL_calloc(1, sizeof(*curdata));
     1.7 +        if (!curdata) {
     1.8 +            SDL_OutOfMemory();
     1.9 +            SDL_free(cursor);
    1.10 +            return NULL;
    1.11 +        }
    1.12  
    1.13          curdata->system_cursor = "default";
    1.14          cursor->driverdata = curdata;
    1.15 @@ -108,7 +113,16 @@
    1.16      }
    1.17  
    1.18      cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor));
    1.19 +    if (!cursor) {
    1.20 +        SDL_OutOfMemory();
    1.21 +        return NULL;
    1.22 +    }
    1.23      curdata = (Emscripten_CursorData *) SDL_calloc(1, sizeof(*curdata));
    1.24 +    if (!curdata) {
    1.25 +        SDL_OutOfMemory();
    1.26 +        SDL_free(cursor);
    1.27 +        return NULL;
    1.28 +    }
    1.29  
    1.30      curdata->system_cursor = cursor_name;
    1.31      cursor->driverdata = curdata;