summaryrefslogtreecommitdiffstats
path: root/progs/util/shaderutil.c
diff options
context:
space:
mode:
authorVinson Lee <[email protected]>2009-11-03 14:41:08 -0700
committerVinson Lee <[email protected]>2009-12-04 17:32:48 -0800
commit5683d7d43fd5a02b72f30a2a6d6a9bfeaf2fa781 (patch)
tree8e2c65591d98d3efa910262e0497326a7fa0dc18 /progs/util/shaderutil.c
parente5bc2a19bdaeeda2aa60562f6a580e27c74e9569 (diff)
progs/util: Fix memory leak if fail to load/compile shader
Signed-off-by: Brian Paul <[email protected]> (cherry picked from commit c475079ef2d901ba4506ebd53e19419cd46793ab)
Diffstat (limited to 'progs/util/shaderutil.c')
-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 629b6f1d972..36e07842c6d 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;
}