Skip to content

Commit

Permalink
Fix memory leak in ObjDump
Browse files Browse the repository at this point in the history
  • Loading branch information
HotKeyIt committed Feb 8, 2020
1 parent bc2788c commit f990ba9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions source/script_object_bif.cpp
Expand Up @@ -520,6 +520,7 @@ __int64 ObjRawSize(IObject *aObject, IObject *aObjects)
}
else
{
aObjects->AddRef();
aKey.symbol = SYM_OBJECT;
aKey.object = aObject;
this_token.object = aObjects;
Expand Down Expand Up @@ -607,6 +608,7 @@ __int64 ObjRawSize(IObject *aObject, IObject *aObjects)
enumerator->Release();
vkey.Free();
vval.Free();
aObjects->Release();
return aSize;
}

Expand Down Expand Up @@ -994,6 +996,7 @@ BIF_DECL(BIF_ObjDump)
var.Free(VAR_ALWAYS_FREE); // Release the variable's old memory. This also removes flags VAR_ATTRIB_OFTEN_REMOVED.
var.mHowAllocated = ALLOC_MALLOC; // Must always be this type to avoid complications and possible memory leaks.
var.mByteContents = aBuffer;
var.mByteCapacity = aResultToken.value_int64;
var.mByteLength = (VarSizeType)aResultToken.value_int64;
}
}
Expand Down

0 comments on commit f990ba9

Please sign in to comment.