Skip to content

Commit

Permalink
Fix double-free in stbi__load_gif_main_outofmem
Browse files Browse the repository at this point in the history
  • Loading branch information
JarLob committed Oct 19, 2023
1 parent beebb24 commit a15dded
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions stb_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -6990,6 +6990,10 @@ static void *stbi__load_gif_main(stbi__context *s, int **delays, int *x, int *y,
stride = g.w * g.h * 4;

if (out) {
if (stride == 0) {
void *ret = stbi__load_gif_main_outofmem(&g, out, delays);
return ret;
}
void *tmp = (stbi_uc*) STBI_REALLOC_SIZED( out, out_size, layers * stride );
if (!tmp)
return stbi__load_gif_main_outofmem(&g, out, delays);
Expand Down

0 comments on commit a15dded

Please sign in to comment.