Fixed crash in shape test program if memory allocation failed.
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Tue, 10 May 2016 21:13:58 +0200
changeset 10165 b30e5eed2600
parent 10164 939647e604d1
child 10166 2393160743ca
Fixed crash in shape test program if memory allocation failed.
test/testshape.c
--- a/test/testshape.c	Tue May 10 21:12:48 2016 +0200
+++ b/test/testshape.c	Tue May 10 21:13:58 2016 +0200
@@ -71,6 +71,10 @@
 
     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++) {