ARB prog parser: Don't leak program string
authorIan Romanick <ian.d.romanick@intel.com>
Tue, 27 Oct 2009 18:46:29 +0000 (11:46 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 28 Oct 2009 00:06:18 +0000 (17:06 -0700)
The program string is kept in the program object.  On the second call
into glProgramStringARB the previous kept string would be leaked.

src/mesa/shader/program_parse.y

index ae9e15ae5ae05151ee7285a2569638d1cf120d98..c3152aa2f88d7f05030a204452c7d5fe9d19985c 100644 (file)
@@ -2278,6 +2278,10 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str,
    _mesa_memcpy (strz, str, len);
    strz[len] = '\0';
 
+   if (state->prog->String != NULL) {
+      _mesa_free(state->prog->String);
+   }
+
    state->prog->String = strz;
 
    state->st = _mesa_symbol_table_ctor();