summaryrefslogtreecommitdiff
path: root/src/util
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
commit05ae10ebff5978ba54ca050ac099295de82fe87b (patch)
tree37eb1d33dff5df36609442d77b9fb09ebd1d68c0 /src/util
parenta518e0163674957099aec026bf8ebe3742b02aae (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 'src/util')
-rw-r--r--src/util/shaderutil.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/util/shaderutil.c b/src/util/shaderutil.c
index 629b6f1d..36e07842 100644
--- a/src/util/shaderutil.c
+++ b/src/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;
}