Pulling out more errant SDL_FreeSurface invocations, and finalizing the image caching. Seems to work properly, and the images are freed all together when the game exits.