Fix a preprocessor memory leak by cleaning up some preprocessor memory management.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24125 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
43e43ce77a
commit
e1dba1b59f
9 changed files with 105 additions and 183 deletions
|
|
@ -97,20 +97,21 @@ TPpContext::TPpContext(TParseContext& pc) :
|
|||
|
||||
TPpContext::~TPpContext()
|
||||
{
|
||||
FinalCPP();
|
||||
for (TSymbolMap::iterator it = symbols.begin(); it != symbols.end(); ++it)
|
||||
delete it->second->mac.body;
|
||||
mem_FreePool(pool);
|
||||
delete [] preamble;
|
||||
}
|
||||
|
||||
void TPpContext::setInput(TInputScanner& input, bool versionWillBeError)
|
||||
{
|
||||
StringInputSrc *in = (StringInputSrc *)malloc(sizeof(StringInputSrc));
|
||||
memset(in, 0, sizeof(StringInputSrc));
|
||||
StringInputSrc* in = new StringInputSrc;
|
||||
in->input = &input;
|
||||
in->base.scan = sourceScan;
|
||||
in->base.getch = (int (*)(TPpContext*, InputSrc *, TPpToken *))sourceGetCh;
|
||||
in->base.ungetch = (void (*)(TPpContext*, InputSrc *, int, TPpToken *))sourceUngetCh;
|
||||
in->base.prev = currentInput;
|
||||
currentInput = &in->base;
|
||||
in->scan = sourceScan;
|
||||
in->getch = (int (*)(TPpContext*, InputSrc *, TPpToken *))sourceGetCh;
|
||||
in->ungetch = (void (*)(TPpContext*, InputSrc *, int, TPpToken *))sourceUngetCh;
|
||||
in->prev = currentInput;
|
||||
currentInput = in;
|
||||
errorOnVersion = versionWillBeError;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue