mesa: fix InfoLog memleak, misc sync with master
authorBrian Paul <brian.paul@tungstengraphics.com>
Wed, 14 May 2008 22:44:08 +0000 (16:44 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Wed, 14 May 2008 22:44:08 +0000 (16:44 -0600)
src/mesa/shader/shader_api.c

index d0512b8ed1dcf21f4179cb4a47c906598eded1ed..badc457c1c09e9ef7e6c6b93016787fc8cc1fc3d 100644 (file)
@@ -126,10 +126,17 @@ _mesa_free_shader_program_data(GLcontext *ctx,
    for (i = 0; i < shProg->NumShaders; i++) {
       _mesa_reference_shader(ctx, &shProg->Shaders[i], NULL);
    }
+   shProg->NumShaders = 0;
+
    if (shProg->Shaders) {
       _mesa_free(shProg->Shaders);
       shProg->Shaders = NULL;
    }
+
+   if (shProg->InfoLog) {
+      _mesa_free(shProg->InfoLog);
+      shProg->InfoLog = NULL;
+   }
 }
 
 
@@ -140,10 +147,7 @@ void
 _mesa_free_shader_program(GLcontext *ctx, struct gl_shader_program *shProg)
 {
    _mesa_free_shader_program_data(ctx, shProg);
-   if (shProg->Shaders) {
-      _mesa_free(shProg->Shaders);
-      shProg->Shaders = NULL;
-   }
+
    _mesa_free(shProg);
 }