Re-Calling SDL_SetVideoMode to resize window?

Hi,
if I call SDL_SetVideoMode a 2nd time to resize my window, will this properly
delete the SDL_Surface it created when I called it for the first time?

SDL_Surface *screen;

screen = SDL_SetVideoMode(640, 480, 16, SDL_SWSURFACE);

// Now I want to change the mode for some reason …
screen = SDL_SetVideoMode(800, 600, 16, SDL_SWSURFACE);

// but what happened to my existing surface? Was is properly deleted?

Hi

if I call SDL_SetVideoMode a 2nd time to resize my window, will this properly
delete the SDL_Surface it created when I called it for the first time?

Yes, as per the SDL_SetVideoMode documentation. Calling SDL_Quit() or
SDL_QuitSubSystem(SDL_INIT_VIDEO) will also free the video surface.

http://www.libsdl.org/cgi/docwiki.cgi/SDL_SetVideoMode

“the surface returned is freed by SDL_Quit and should not be freed by
the caller. Note: This rule includes consecutive calls to
SDL_SetVideoMode (i.e. resize or resolution change) - the pre-existing
surface will be released automatically”