From 7e1ee2d386b7ec334cf01660ced88426e5188a40 Mon Sep 17 00:00:00 2001 From: Thatcher Ulrich Date: Wed, 2 Mar 2016 15:56:53 -0500 Subject: [PATCH] Allocate large structure using malloc instead of stack. --- stb_image.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/stb_image.h b/stb_image.h index a128a5e..08d2f84 100644 --- a/stb_image.h +++ b/stb_image.h @@ -3442,9 +3442,12 @@ static int stbi__jpeg_info_raw(stbi__jpeg *j, int *x, int *y, int *comp) static int stbi__jpeg_info(stbi__context *s, int *x, int *y, int *comp) { - stbi__jpeg j; - j.s = s; - return stbi__jpeg_info_raw(&j, x, y, comp); + int result; + stbi__jpeg* j = (stbi__jpeg*) (stbi__malloc(sizeof(stbi__jpeg))); + j->s = s; + result = stbi__jpeg_info_raw(j, x, y, comp); + STBI_FREE(j); + return result; } #endif