Fixes several potential leaks
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2022-05-14 17:36:38 +02:00
parent a4471ec5b1
commit 727aab37d7
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
3 changed files with 3 additions and 4 deletions

View File

@ -12,8 +12,7 @@ export_func u8 CreatureLib_ExecutingAttack_Construct(ExecutingAttack*& out, Crea
for (size_t i = 0; i < targetCount; i++) {
ls.Append(targets[i]);
}
auto s = ArbUt::OptionalUniquePtr<BattleScript>(script);
out = new ExecutingAttack(ls, numberHits, user, attack, attackData, s);
out = new ExecutingAttack(ls, numberHits, user, attack, attackData, script);
})
}

View File

@ -16,5 +16,5 @@ export_func u8 CreatureLib_ScriptResolver_LoadScript(BattleScript*& out, ScriptR
export_func u8 CreatureLib_ScriptResolver_LoadItemScript(ItemUseScript*& out, ScriptResolver* p,
const CreatureLib::Library::Item* item) {
Try(out = p->LoadItemScript(item);)
Try(out = p->LoadItemScript(item).TakeOwnership();)
};

View File

@ -50,7 +50,7 @@ namespace CreatureLib::Battling {
auto& current = _scripts[_index];
if (!current.IsSet()) {
auto s = current.GetScript();
out = *s;
out = s->GetValue();
return true;
} else {
auto& set = current.GetScriptSet()->GetIterator();