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