Fix preprocessor memory leak.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22195 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
db4cd54dac
commit
554c854143
@ -1032,24 +1032,26 @@ int MacroExpand(int atom, yystypepp* yylvalpp, int expandUndef)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// no recursive expansions
|
||||||
if (sym && sym->details.mac.busy)
|
if (sym && sym->details.mac.busy)
|
||||||
return 0; // no recursive expansions
|
return 0;
|
||||||
|
|
||||||
|
// not expanding of undefined symbols
|
||||||
|
if ((! sym || sym->details.mac.undef) && ! expandUndef)
|
||||||
|
return 0;
|
||||||
|
|
||||||
in = (MacroInputSrc*)malloc(sizeof(*in));
|
in = (MacroInputSrc*)malloc(sizeof(*in));
|
||||||
memset(in, 0, sizeof(*in));
|
memset(in, 0, sizeof(*in));
|
||||||
in->base.line = cpp->currentInput->line;
|
in->base.line = cpp->currentInput->line;
|
||||||
in->base.name = cpp->currentInput->name;
|
in->base.name = cpp->currentInput->name;
|
||||||
|
|
||||||
if ((! sym || sym->details.mac.undef)) {
|
if ((! sym || sym->details.mac.undef) && expandUndef) {
|
||||||
if (expandUndef) {
|
|
||||||
// push input
|
// push input
|
||||||
in->base.scan = zero_scan;
|
in->base.scan = zero_scan;
|
||||||
in->base.prev = cpp->currentInput;
|
in->base.prev = cpp->currentInput;
|
||||||
cpp->currentInput = &in->base;
|
cpp->currentInput = &in->base;
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
} else
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
in->base.scan = macro_scan;
|
in->base.scan = macro_scan;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user