fixed double allocation of metadata.

This commit is contained in:
Christoph Oelckers 2017-02-28 14:44:18 +01:00
parent 168627f549
commit 5f6da0d222

View file

@ -3361,7 +3361,7 @@ PField *PClass::AddField(FName name, PType *type, DWORD flags)
// Only initialize the defaults if they have already been created.
// For ZScript this is not the case, it will first define all fields before
// setting up any defaults for any class.
if (field != nullptr && !(flags & VARF_Native))
if (field != nullptr && !(flags & VARF_Native) && Meta != nullptr)
{
Meta = (BYTE *)M_Realloc(Meta, MetaSize);
memset(Meta + oldsize, 0, MetaSize - oldsize);