progs/util: Exit RawImageGetData early if malloc fails.
authorVinson Lee <vlee@vmware.com>
Fri, 20 Nov 2009 20:11:55 +0000 (12:11 -0800)
committerVinson Lee <vlee@vmware.com>
Fri, 20 Nov 2009 20:11:55 +0000 (12:11 -0800)
Prevents a null pointer deference later on.

progs/util/readtex.c

index 1e1183cf9ac8bfcd21ede53b23c2a3198b8a117c..81cb626e911d5a4c501eec11fadfec0506ec45f8 100644 (file)
@@ -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;