progs/util: Fix memory leak if malloc fails in tkRGBImageLoad.
authorVinson Lee <vlee@vmware.com>
Tue, 17 Nov 2009 19:04:24 +0000 (11:04 -0800)
committerVinson Lee <vlee@vmware.com>
Tue, 17 Nov 2009 19:04:24 +0000 (11:04 -0800)
progs/util/readtex.c

index ec27e20d6818d437b984423950a3ae9ab7c67eee..c57b66bd9d3bada8bdc62445df9ee2ee814dc4d9 100644 (file)
@@ -250,6 +250,7 @@ static TK_RGBImageRec *tkRGBImageLoad(const char *fileName)
    final = (TK_RGBImageRec *)malloc(sizeof(TK_RGBImageRec));
    if (final == NULL) {
       fprintf(stderr, "Out of memory!\n");
+      RawImageClose(raw);
       return NULL;
    }
    final->sizeX = raw->sizeX;