Free data upon failure in LoadImage()

Otherwise, if SDL_CreateRGBSurfaceFrom() returned NULL, then this memory
would be leaked.
This commit is contained in:
Misa authored and Ethan Lee committed 2021-01-18 13:06:43 -05:00
1 parent 626aac59fb
commit adbab6355b
1 file changed
+1
@@ -76,6 +76,7 @@ static SDL_Surface* LoadImage(const char *filename, bool noBlend = true, bool no
}
else
{
SDL_free(data);
fprintf(stderr,"Image not found: %s\n", filename);
SDL_assert(0 && "Image not found! See stderr.");
return NULL;