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>
Fri, 4 Dec 2009 00:57:17 +0000 (16:57 -0800)
(cherry picked from commit 786d539511eb3c5a4101b11b7f8e90d60123ac46)

progs/util/readtex.c

index ec27e20..c57b66b 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;