From 49a80ca2bcca1c1d9c341c332c5a4b07b6b3b2fd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 28 Apr 2006 15:40:11 +0000 Subject: [PATCH] fix first memory leak (bug 5557) --- src/mesa/shader/arbprogparse.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index de63c50b36a..b52525e669f 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -3884,6 +3884,10 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, err = !grammar_check(grammar_syn_id, (byte *) arb_grammar_text, &parsed, &parsed_len); + /* 'parsed' is unused here */ + _mesa_free (parsed); + parsed = NULL; + /* NOTE: we can't destroy grammar_syn_id right here because * grammar_destroy() can reset the last error */ @@ -3956,6 +3960,7 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, /* Syntax parse error */ if (err) { _mesa_free(strz); + _mesa_free(parsed); grammar_get_last_error ((GLubyte *) error_msg, 300, &error_pos); _mesa_set_program_error (ctx, error_pos, error_msg); _mesa_error (ctx, GL_INVALID_OPERATION, -- 2.30.2