mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-27 22:42:29 +00:00
Fix memory leak from ZCC_OpInfo operator prototypes
This commit is contained in:
parent
5c1ec2c0bf
commit
e4a74f4bbe
2 changed files with 23 additions and 0 deletions
|
@ -33,6 +33,27 @@ struct OpProto2
|
|||
EvalConst2op EvalConst;
|
||||
};
|
||||
|
||||
static struct FreeOpInfoProtos
|
||||
{
|
||||
~FreeOpInfoProtos()
|
||||
{
|
||||
for (size_t i = 0; i < countof(ZCC_OpInfo); ++i)
|
||||
{
|
||||
ZCC_OpInfo[i].FreeAllProtos();
|
||||
}
|
||||
}
|
||||
} ProtoFreeer;
|
||||
|
||||
void ZCC_OpInfoType::FreeAllProtos()
|
||||
{
|
||||
for (ZCC_OpProto *proto = Protos, *next = NULL; proto != NULL; proto = next)
|
||||
{
|
||||
next = proto->Next;
|
||||
delete proto;
|
||||
}
|
||||
Protos = NULL;
|
||||
}
|
||||
|
||||
void ZCC_OpInfoType::AddProto(PType *res, PType *optype, EvalConst1op evalconst)
|
||||
{
|
||||
ZCC_OpProto *proto = new ZCC_OpProto(res, optype, NULL);
|
||||
|
|
|
@ -489,6 +489,8 @@ struct ZCC_OpInfoType
|
|||
ZCC_OpProto *FindBestProto(PType *optype, const PType::Conversion **route, int &numslots);
|
||||
ZCC_OpProto *FindBestProto(PType *left, const PType::Conversion **route1, int &numslots,
|
||||
PType *right, const PType::Conversion **route2, int &numslots2);
|
||||
|
||||
void FreeAllProtos();
|
||||
};
|
||||
|
||||
#define CONVERSION_ROUTE_SIZE 8
|
||||
|
|
Loading…
Reference in a new issue