diff src/video/x11/SDL_x11video.c @ 2323:4ac07ae446d3

Fixed many valgrind errors. But, I broke testdyngl.
author Bob Pendleton <bob@pendleton.com>
date Thu, 06 Mar 2008 23:07:02 +0000
parents fbe8ff44c519
children 3202e4826c57
line wrap: on
line diff
--- a/src/video/x11/SDL_x11video.c	Thu Mar 06 17:08:10 2008 +0000
+++ b/src/video/x11/SDL_x11video.c	Thu Mar 06 23:07:02 2008 +0000
@@ -120,14 +120,14 @@
 
     /* Initialize all variables that we clean on shutdown */
     device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
-    if (device) {
-        data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
+    if (!device) {
+        SDL_OutOfMemory();
+        return NULL;
     }
-    if (!device || !data) {
+    data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
+    if (!data) {
         SDL_OutOfMemory();
-        if (device) {
-            SDL_free(device);
-        }
+        SDL_free(device);
         return NULL;
     }
     device->driverdata = data;