Be sure cleanup in i>image_size exit case
This commit is contained in:
parent
9cf5cafd28
commit
095675b012
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user