summaryrefslogtreecommitdiff
path: root/src/mesa/shader/nvfragparse.c
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2009-10-27 13:40:18 -0700
committerIan Romanick <ian.d.romanick@intel.com>2009-10-27 17:06:18 -0700
commit93dae6761bc90bbd43b450d2673620ec189b2c7a (patch)
tree034b2c8d4c50ecf5e96e9b8c255421e487c90b88 /src/mesa/shader/nvfragparse.c
parent8df9587d68752f3369cc1eda1606d3b7c1041ec6 (diff)
ARB prog parser: Fix epic memory leak in lexer / parser interface
Anything that matched IDENTIFIER was strdup'ed and returned to the parser. However, almost every case of IDENTIFIER in the parser just dropped the returned string on the floor. Every swizzle string, every option string, every use of a variable, etc. leaked memory. Create a temporary buffer in the parser state (string_dumpster and dumpster_size). Return strings from the lexer to the parser in the buffer. Grow the buffer as needed. When the parser needs to keep a string (i.e., delcaring a new variable), let it make a copy then. The only leak that valgrind now detects is /occasionally/ the copy of the program string in gl_program::String is leaked. I'm not seeing how. :(
Diffstat (limited to 'src/mesa/shader/nvfragparse.c')
0 files changed, 0 insertions, 0 deletions