From: Vinson Lee Date: Tue, 3 Nov 2009 21:41:08 +0000 (-0700) Subject: progs/util: Fix memory leak if fail to load/compile shader X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5683d7d43fd5a02b72f30a2a6d6a9bfeaf2fa781;p=mesa.git progs/util: Fix memory leak if fail to load/compile shader Signed-off-by: Brian Paul (cherry picked from commit c475079ef2d901ba4506ebd53e19419cd46793ab) --- 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; }