From c475079ef2d901ba4506ebd53e19419cd46793ab Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 3 Nov 2009 14:41:08 -0700 Subject: [PATCH] progs/util: Fix memory leak if fail to load/compile shader Signed-off-by: Brian Paul --- progs/util/shaderutil.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/progs/util/shaderutil.c b/progs/util/shaderutil.c index 4db950016b8..af50d64f510 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; } -- 2.30.2