From 6b8f7241bbfe7e28731a5c96863b834008f24d5c Mon Sep 17 00:00:00 2001 From: zawz Date: Tue, 25 May 2021 11:54:38 +0200 Subject: [PATCH] fix memory leak --- include/struc.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/struc.hpp b/include/struc.hpp index 2bb87eb..8bd007f 100644 --- a/include/struc.hpp +++ b/include/struc.hpp @@ -243,7 +243,10 @@ public: redirect(arg* in) { type=_obj::_redirect; target=in; here_document=nullptr; } redirect(std::string strop, arg* in) { type=_obj::_redirect; op=strop; target=in; here_document=nullptr; } redirect(std::string strop, arg* in, arg* doc) { type=_obj::_redirect; op=strop; target=in; here_document=doc; } - ~redirect() { if(target != nullptr) delete target; } + ~redirect() { + if(target != nullptr) delete target; + if(here_document != nullptr) delete here_document; + } std::string generate(int ind);