From d5e16c3826dad569e7f77fa34f1d55dad71f6fc0 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Thu, 25 Jul 2019 17:30:42 +0200 Subject: [PATCH] Removed memory leaks in function classes --- src/Evaluator/EvalValues/ScriptFunctionEvalValue.hpp | 4 ++++ src/FunctionScriptType.hpp | 1 + 2 files changed, 5 insertions(+) diff --git a/src/Evaluator/EvalValues/ScriptFunctionEvalValue.hpp b/src/Evaluator/EvalValues/ScriptFunctionEvalValue.hpp index 1539e50..4243db3 100644 --- a/src/Evaluator/EvalValues/ScriptFunctionEvalValue.hpp +++ b/src/Evaluator/EvalValues/ScriptFunctionEvalValue.hpp @@ -49,6 +49,10 @@ namespace Porygon::Evaluation { _hash(hash), _options(new vector>()){ } + ~GenericFunctionEvalValue() final{ + delete _options; + } + GenericFunctionEvalValue(const GenericFunctionEvalValue& _) = delete; GenericFunctionEvalValue() = delete; GenericFunctionEvalValue& operator =(GenericFunctionEvalValue v) = delete; diff --git a/src/FunctionScriptType.hpp b/src/FunctionScriptType.hpp index f67f6c3..21799d1 100644 --- a/src/FunctionScriptType.hpp +++ b/src/FunctionScriptType.hpp @@ -67,6 +67,7 @@ namespace Porygon { for (auto o: *_options){ delete o; } + delete _options; } void RegisterFunctionOption (GenericFunctionOption * opt) const{