Skip to content

Commit

Permalink
Fix closing file when jpg too large
Browse files Browse the repository at this point in the history
  • Loading branch information
rickgaiser committed May 7, 2020
1 parent 4c00bcb commit 0d550c9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/textures.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,8 +542,11 @@ int texJpgLoad(GSTEXTURE *texture, const char *path, int texId, short psm)
if (file) {
jpg = jpgOpenFILE(file, JPG_NORMAL);
if (jpg != NULL) {
if (texSizeValidate(jpg->width, jpg->height, psm) < 0)
if (texSizeValidate(jpg->width, jpg->height, psm) < 0) {
jpgClose(jpg);
fclose(file);
return ERR_BAD_DIMENSION;
}

size_t size = gsKit_texture_size_ee(jpg->width, jpg->height, psm);
texture->Mem = memalign(128, size);
Expand Down

0 comments on commit 0d550c9

Please sign in to comment.