Commit 4c8d994d authored by Ryan C. Gordon's avatar Ryan C. Gordon

Clean up have-initialized resources in some failing edge cases.

   Maybe fixes Bugzilla #426.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402353
parent 43816f49
...@@ -408,7 +408,7 @@ static void create_aux_windows(_THIS) ...@@ -408,7 +408,7 @@ static void create_aux_windows(_THIS)
} }
} }
/* Setup the communication with the IM server */ /* Setup the communication with the IM server */
SDL_IM = NULL; SDL_IM = NULL;
SDL_IC = NULL; SDL_IC = NULL;
...@@ -483,6 +483,8 @@ static int X11_VideoInit(_THIS, SDL_PixelFormat *vformat) ...@@ -483,6 +483,8 @@ static int X11_VideoInit(_THIS, SDL_PixelFormat *vformat)
*/ */
GFX_Display = XOpenDisplay(display); GFX_Display = XOpenDisplay(display);
if ( GFX_Display == NULL ) { if ( GFX_Display == NULL ) {
XCloseDisplay(SDL_Display);
SDL_Display = NULL;
SDL_SetError("Couldn't open X11 display"); SDL_SetError("Couldn't open X11 display");
return(-1); return(-1);
} }
...@@ -508,8 +510,13 @@ static int X11_VideoInit(_THIS, SDL_PixelFormat *vformat) ...@@ -508,8 +510,13 @@ static int X11_VideoInit(_THIS, SDL_PixelFormat *vformat)
#endif /* NO_SHARED_MEMORY */ #endif /* NO_SHARED_MEMORY */
/* Get the available video modes */ /* Get the available video modes */
if(X11_GetVideoModes(this) < 0) if(X11_GetVideoModes(this) < 0) {
XCloseDisplay(GFX_Display);
GFX_Display = NULL;
XCloseDisplay(SDL_Display);
SDL_Display = NULL;
return -1; return -1;
}
/* Determine the current screen size */ /* Determine the current screen size */
this->info.current_w = DisplayWidth(SDL_Display, SDL_Screen); this->info.current_w = DisplayWidth(SDL_Display, SDL_Screen);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment