From 4eec0c02fc2b9278571f4f3db4623d04e7eefd9d Mon Sep 17 00:00:00 2001 From: "Maya B. Gokhale" Date: Wed, 8 Jan 2020 15:06:23 -0800 Subject: [PATCH] improving destructor for hNode --- plugins/xlat/hNode.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/xlat/hNode.h b/plugins/xlat/hNode.h index e4daa37bc..c3e99daea 100644 --- a/plugins/xlat/hNode.h +++ b/plugins/xlat/hNode.h @@ -71,8 +71,17 @@ namespace hnode { h_name = s; h_op = h; } - - ~hNode() { if (!is_leaf) child_list.clear(); } + + ~hNode() { + if (!child_list.empty()) { + list::iterator it; + for (it = child_list.begin(); it != child_list.end(); ++it) { + delete *it; + } + } + //cout << "visited hNode destructor\n"; + + } void setleaf(string s, hdlopsEnum h) {