From 6e80e6b3cffaf42723c61443244e04977a0fe8ed Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sat, 12 Oct 2019 07:14:52 -0500 Subject: hscript: Ensure resources are reclaimed when Script is destroyed --- hscript/script.cc | 4 ++++ hscript/script.hh | 3 +++ 2 files changed, 7 insertions(+) (limited to 'hscript') diff --git a/hscript/script.cc b/hscript/script.cc index 585a18c..e324356 100644 --- a/hscript/script.cc +++ b/hscript/script.cc @@ -169,6 +169,10 @@ Script::Script() { internal = new ScriptPrivate; } +Script::~Script() { + delete internal; +} + const Script *Script::load(const std::string path, const ScriptOptions opts) { std::ifstream file(path); if(!file) { diff --git a/hscript/script.hh b/hscript/script.hh index 16c2ab4..daacf96 100644 --- a/hscript/script.hh +++ b/hscript/script.hh @@ -48,6 +48,9 @@ private: Script(); ScriptOptions opts; public: + /*! Free resources associated with the Script. */ + ~Script(); + /*! Load a HorizonScript from the specified path. * @param path The path to load from. * @param options Options to use for parsing, validation, and execution. -- cgit v1.2.3-70-g09d2