summaryrefslogtreecommitdiff
path: root/progs
diff options
context:
space:
mode:
authorVinson Lee <vlee@vmware.com>2009-11-03 14:41:08 -0700
committerVinson Lee <vlee@vmware.com>2009-12-04 17:32:48 -0800
commit5683d7d43fd5a02b72f30a2a6d6a9bfeaf2fa781 (patch)
tree8e2c65591d98d3efa910262e0497326a7fa0dc18 /progs
parente5bc2a19bdaeeda2aa60562f6a580e27c74e9569 (diff)
progs/util: Fix memory leak if fail to load/compile shader
Signed-off-by: Brian Paul <brianp@vmware.com> (cherry picked from commit c475079ef2d901ba4506ebd53e19419cd46793ab)
Diffstat (limited to 'progs')
-rw-r--r--progs/util/shaderutil.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/progs/util/shaderutil.c b/progs/util/shaderutil.c
index 629b6f1d97..36e07842c6 100644
--- a/progs/util/shaderutil.c
+++ b/progs/util/shaderutil.c
@@ -88,6 +88,7 @@ CompileShaderFile(GLenum shaderType, const char *filename)
f = fopen(filename, "r");
if (!f) {
fprintf(stderr, "Unable to open shader file %s\n", filename);
+ free(buffer);
return 0;
}
@@ -98,6 +99,7 @@ CompileShaderFile(GLenum shaderType, const char *filename)
shader = CompileShaderText(shaderType, buffer);
}
else {
+ free(buffer);
return 0;
}