Mesa (mesa_7_6_branch): progs/util: Fix memory leak if malloc fails in tkRGBImageLoad.

Vinson Lee vlee at kemper.freedesktop.org
Thu Dec 3 16:58:01 PST 2009


Module: Mesa
Branch: mesa_7_6_branch
Commit: 772e00478124074c7b954fad52974057f0669a9b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=772e00478124074c7b954fad52974057f0669a9b

Author: Vinson Lee <vlee at vmware.com>
Date:   Tue Nov 17 11:04:24 2009 -0800

progs/util: Fix memory leak if malloc fails in tkRGBImageLoad.
(cherry picked from commit 786d539511eb3c5a4101b11b7f8e90d60123ac46)

---

 progs/util/readtex.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/progs/util/readtex.c b/progs/util/readtex.c
index ec27e20..c57b66b 100644
--- a/progs/util/readtex.c
+++ b/progs/util/readtex.c
@@ -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;



More information about the mesa-commit mailing list