Browse Source

Fix the memory leak.

louyihua 9 years ago
parent
commit
dc5c836884
1 changed files with 3 additions and 0 deletions
  1. 3 0
      video.c

+ 3 - 0
video.c

@@ -630,6 +630,9 @@ VIDEO_SetPalette(
    SDL_SetSurfaceColorMod(gpScreenBak, 0xFF, 0xFF, 0xFF);
 
    VIDEO_UpdateScreen(NULL);
+
+   // The palette should be freed, or memory leak occurs.
+   SDL_FreePalette(palette);
 #else
    SDL_SetPalette(gpScreen, SDL_LOGPAL | SDL_PHYSPAL, rgPalette, 0, 256);
    SDL_SetPalette(gpScreenBak, SDL_LOGPAL | SDL_PHYSPAL, rgPalette, 0, 256);