summaryrefslogtreecommitdiff
path: root/progs/util
diff options
context:
space:
mode:
authorVinson Lee <vlee@vmware.com>2009-11-03 14:41:08 -0700
committerBrian Paul <brianp@vmware.com>2009-11-03 14:49:41 -0700
commitc475079ef2d901ba4506ebd53e19419cd46793ab (patch)
tree9fc6d56fd3758b38d6ff90e4f03a1b39de6e773b /progs/util
parentceb6728725a1eefe35a4d8371b2ff0abe212b5ad (diff)
progs/util: Fix memory leak if fail to load/compile shader
Signed-off-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'progs/util')
-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 4db950016b..af50d64f51 100644
--- a/progs/util/shaderutil.c
+++ b/progs/util/shaderutil.c
@@ -84,6 +84,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;
}
@@ -94,6 +95,7 @@ CompileShaderFile(GLenum shaderType, const char *filename)
shader = CompileShaderText(shaderType, buffer);
}
else {
+ free(buffer);
return 0;
}