Be sure cleanup in i>image_size exit case

This commit is contained in:
Kevin Lange 2014-05-23 18:56:49 -07:00
parent 9cf5cafd28
commit 095675b012

View File

@ -341,7 +341,7 @@ void load_sprite(sprite_t * sprite, char * filename) {
for (y = 0; y < height; ++y) {
for (x = 0; x < width; ++x) {
if (i > image_size) return;
if (i > image_size) goto _cleanup_sprite;
/* Extract the color */
uint32_t color;
if (bpp == 24) {
@ -360,6 +360,7 @@ void load_sprite(sprite_t * sprite, char * filename) {
i += row_width;
}
_cleanup_sprite:
fclose(image);
free(bufferb);
}