Mesa (mesa_7_6_branch): progs/tests: Fix memory leak in texdown. c if malloc fails.

Vinson Lee vlee at kemper.freedesktop.org
Fri Dec 4 07:17:50 UTC 2009


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

Author: Vinson Lee <vlee at vmware.com>
Date:   Wed Nov 18 17:30:50 2009 -0800

progs/tests: Fix memory leak in texdown.c if malloc fails.
(cherry picked from commit e3cfd78969cd4a94fc83a5d6fb2f33730cc4e70f)

---

 progs/tests/texdown.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/progs/tests/texdown.c b/progs/tests/texdown.c
index 7e46045..e6881d3 100644
--- a/progs/tests/texdown.c
+++ b/progs/tests/texdown.c
@@ -176,6 +176,8 @@ MeasureDownloadRate(void)
    orig_getImage = (GLubyte *) malloc(image_bytes + ALIGN);
    if (!orig_texImage || !orig_getImage) {
       DownloadRate = 0.0;
+      free(orig_texImage);
+      free(orig_getImage);
       return;
    }
 




More information about the mesa-commit mailing list