From 577f105c615eb8e34a658c7d58ea111578f3687a Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Fri, 11 Dec 2020 16:42:58 +0100 Subject: [PATCH] Result destructor for _errorMessage. --- src/Result.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Result.hpp b/src/Result.hpp index 05b392f..92bb58a 100644 --- a/src/Result.hpp +++ b/src/Result.hpp @@ -45,6 +45,12 @@ namespace ArbUt { return *this; } + ~Result() { + if (_resultStatus == ResultStatus::Error) { + delete _errorMessage; + } + } + /// @brief Returns whether or not the function succeeded, /// @return Whether or not the function succeeded. [[nodiscard]] inline ResultStatus GetStatus() const noexcept { return _resultStatus; }