mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-19 08:28:21 +02:00
progs/util: Fix memory leak if fail to load/compile shader
Signed-off-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit c475079ef2)
This commit is contained in:
parent
e5bc2a19bd
commit
5683d7d43f
1 changed files with 2 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue