Fix stb_image memory leak

This commit is contained in:
Dorian Wouters 2016-01-27 16:44:14 +01:00
parent 21ee45095b
commit 7c3a144444

View file

@ -58,12 +58,14 @@ u8* load_image(const char* image, u32 width, u32 height) {
if(imgWidth != width || imgHeight != height) {
printf("ERROR: Image must be exactly %d x %d in size.\n", width, height);
stbi_image_free(img);
return NULL;
}
if(imgDepth != STBI_rgb_alpha) {
printf("ERROR: Decoded image does't match expected format (%d, wanted %d).\n",
imgDepth, STBI_rgb_alpha);
stbi_image_free(img);
return NULL;
}