Corrected malloc and implemented automatic free/SDL_FreeSurface