Skip to content

Commit

Permalink
Fixed memory leak when cloning an object which owns no properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lexikos committed Dec 20, 2023
1 parent cc356bc commit 618cfb3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/script_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ Object *Object::CloneTo(Object &obj)
{
// Allocate space in destination object.
auto field_count = mFields.Length();
if (!obj.SetInternalCapacity(field_count))
if (field_count && !obj.SetInternalCapacity(field_count))
{
obj.Release();
return NULL;
Expand Down

0 comments on commit 618cfb3

Please sign in to comment.