Commit 73b63e5b57c7f7fa50b4ca7a09f48e12298e9d91

Philipp Wiesemann 2016-05-10T21:13:58

Fixed crash in shape test program if memory allocation failed.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/test/testshape.c b/test/testshape.c
index 00750a9..476fac2 100644
--- a/test/testshape.c
+++ b/test/testshape.c
@@ -71,6 +71,10 @@ int main(int argc,char** argv)
 
     num_pictures = argc - 1;
     pictures = (LoadedPicture *)SDL_malloc(sizeof(LoadedPicture)*num_pictures);
+    if (!pictures) {
+        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not allocate memory.");
+        exit(1);
+    }
     for(i=0;i<num_pictures;i++)
         pictures[i].surface = NULL;
     for(i=0;i<num_pictures;i++) {