diff --git a/src/opengl.c b/src/opengl.c index c609230..355f6d5 100644 --- a/src/opengl.c +++ b/src/opengl.c @@ -515,10 +515,6 @@ int gl_init(void) { } } - for(i = 0; modes[i]; ++i) - free(modes[i]); - free(modes); - // Make sure fullscreen mode is supported. if(flags & SDL_FULLSCREEN && !supported) { WARN("Fullscreen mode %dx%d is not supported by your current setup, switching to another mode", @@ -526,6 +522,10 @@ int gl_init(void) { gl_screen.w = modes[0]->w; gl_screen.h = modes[0]->h; } + // Free the video modes. + for(i = 0; modes[i]; ++i) + free(modes[i]); + free(modes); } // Test the setup.