Avoid double-free in functions cloned for vulkan relaxed mode (#2987)
* Avoid double-free in functions cloned for vulkan relaxed mode When rewriting function calls atomicCounterIncrement and atoicCounterDecrement, clone the parameters so that the TParameter 'type' field is cloned. This avoids double-free when both the original and transformed functions are deleted by the parser. Fixes a ubsan failure.
This commit is contained in:
parent
f0ce653a25
commit
f28022c9f9
3 changed files with 9 additions and 6 deletions
|
|
@ -224,7 +224,7 @@ struct TParameter {
|
|||
TString *name;
|
||||
TType* type;
|
||||
TIntermTyped* defaultValue;
|
||||
void copyParam(const TParameter& param)
|
||||
TParameter& copyParam(const TParameter& param)
|
||||
{
|
||||
if (param.name)
|
||||
name = NewPoolTString(param.name->c_str());
|
||||
|
|
@ -232,6 +232,7 @@ struct TParameter {
|
|||
name = 0;
|
||||
type = param.type->clone();
|
||||
defaultValue = param.defaultValue;
|
||||
return *this;
|
||||
}
|
||||
TBuiltInVariable getDeclaredBuiltIn() const { return type->getQualifier().declaredBuiltIn; }
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue