mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
fix potential NULL dereference (bug 11880)
This commit is contained in:
parent
872d179141
commit
237b985356
1 changed files with 6 additions and 2 deletions
|
|
@ -377,7 +377,7 @@ _mesa_attach_shader(GLcontext *ctx, GLuint program, GLuint shader)
|
|||
struct gl_shader_program *shProg
|
||||
= _mesa_lookup_shader_program(ctx, program);
|
||||
struct gl_shader *sh = _mesa_lookup_shader(ctx, shader);
|
||||
const GLuint n = shProg->NumShaders;
|
||||
GLuint n;
|
||||
GLuint i;
|
||||
|
||||
if (!shProg || !sh) {
|
||||
|
|
@ -386,6 +386,8 @@ _mesa_attach_shader(GLcontext *ctx, GLuint program, GLuint shader)
|
|||
return;
|
||||
}
|
||||
|
||||
n = shProg->NumShaders;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
if (shProg->Shaders[i] == sh) {
|
||||
/* already attached */
|
||||
|
|
@ -547,7 +549,7 @@ _mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader)
|
|||
{
|
||||
struct gl_shader_program *shProg
|
||||
= _mesa_lookup_shader_program(ctx, program);
|
||||
const GLuint n = shProg->NumShaders;
|
||||
GLuint n;
|
||||
GLuint i, j;
|
||||
|
||||
if (!shProg) {
|
||||
|
|
@ -556,6 +558,8 @@ _mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader)
|
|||
return;
|
||||
}
|
||||
|
||||
n = shProg->NumShaders;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
if (shProg->Shaders[i]->Name == shader) {
|
||||
/* found it */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue