fix a memory leak: free the default video surface in GAL_SetVideoModeInfo

This commit is contained in:
Vincent Wei
2020-03-25 20:03:32 +08:00
parent 86da42231c
commit 0c5f5115e6

View File

@@ -628,6 +628,13 @@ void GAL_SetVideoModeInfo(GAL_Surface* screen)
{
assert(screen);
if (GAL_VideoSurface) {
GAL_Surface *ready_to_go;
ready_to_go = GAL_VideoSurface;
GAL_VideoSurface = NULL;
GAL_FreeSurface (ready_to_go);
}
GAL_VideoSurface = screen;
__mg_current_video->info.vfmt = __gal_screen->format;
__mg_current_video->offset_x = 0;