summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2009-10-27 13:40:18 -0700
committerIan Romanick <[email protected]>2009-10-27 17:06:18 -0700
commit93dae6761bc90bbd43b450d2673620ec189b2c7a (patch)
tree034b2c8d4c50ecf5e96e9b8c255421e487c90b88 /src/mesa/state_tracker
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/state_tracker')
0 files changed, 0 insertions, 0 deletions