Catch out of memory errors creating a window
authorSam Lantinga <slouken@libsdl.org>
Wed, 10 Jul 2013 22:13:19 -0700
changeset 7399 f35ff854121a
parent 7398 31ec14665b79
child 7400 243dad4e5f29
Catch out of memory errors creating a window
src/video/SDL_video.c
--- a/src/video/SDL_video.c	Wed Jul 10 22:06:11 2013 -0700
+++ b/src/video/SDL_video.c	Wed Jul 10 22:13:19 2013 -0700
@@ -1212,6 +1212,10 @@
         }
     }
     window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
+    if (!window) {
+        SDL_OutOfMemory();
+        return NULL;
+    }
     window->magic = &_this->window_magic;
     window->id = _this->next_object_id++;
     window->x = x;
@@ -1267,6 +1271,10 @@
         return NULL;
     }
     window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
+    if (!window) {
+        SDL_OutOfMemory();
+        return NULL;
+    }
     window->magic = &_this->window_magic;
     window->id = _this->next_object_id++;
     window->flags = SDL_WINDOW_FOREIGN;