From a0ac8fc7d8d946183ba0506a8134a6e55819e151 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 12:11:55 -0800 Subject: progs/util: Exit RawImageGetData early if malloc fails. Prevents a null pointer deference later on. (cherry picked from commit e26135a744f740430e3dc341fa692544ba99c11e) --- progs/util/readtex.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs/util') diff --git a/progs/util/readtex.c b/progs/util/readtex.c index 1e1183cf9a..81cb626e91 100644 --- a/progs/util/readtex.c +++ b/progs/util/readtex.c @@ -230,6 +230,7 @@ static void RawImageGetData(rawImageRec *raw, TK_RGBImageRec *final) final->data = (unsigned char *)malloc((raw->sizeX+1)*(raw->sizeY+1)*4); if (final->data == NULL) { fprintf(stderr, "Out of memory!\n"); + return; } ptr = final->data; -- cgit v1.2.3