mirror of
https://github.com/qemu/qemu.git
synced 2024-12-04 01:03:38 +08:00
ui/shader: fix potential leak of shader on error
Value of 0 for program and shaders are silently ignored and indicate error. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
4b7b661d8f
commit
8fe496adac
@ -130,15 +130,17 @@ static GLuint qemu_gl_create_link_program(GLuint vert, GLuint frag)
|
||||
static GLuint qemu_gl_create_compile_link_program(const GLchar *vert_src,
|
||||
const GLchar *frag_src)
|
||||
{
|
||||
GLuint vert_shader, frag_shader, program;
|
||||
GLuint vert_shader, frag_shader, program = 0;
|
||||
|
||||
vert_shader = qemu_gl_create_compile_shader(GL_VERTEX_SHADER, vert_src);
|
||||
frag_shader = qemu_gl_create_compile_shader(GL_FRAGMENT_SHADER, frag_src);
|
||||
if (!vert_shader || !frag_shader) {
|
||||
return 0;
|
||||
goto end;
|
||||
}
|
||||
|
||||
program = qemu_gl_create_link_program(vert_shader, frag_shader);
|
||||
|
||||
end:
|
||||
glDeleteShader(vert_shader);
|
||||
glDeleteShader(frag_shader);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user