From: Tim King Date: Tue, 26 Sep 2017 06:51:42 +0000 (-0700) Subject: Fixing CIDs 1172012 and 1172011: Initiallzing d_exprManager to nullptr in const_itera... X-Git-Tag: cvc5-1.0.0~5616 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=75728d632b9ce5d8c75bbf208ef788bf7ce78f9e;p=cvc5.git Fixing CIDs 1172012 and 1172011: Initiallzing d_exprManager to nullptr in const_iterator. (#1140) --- diff --git a/src/expr/expr_template.cpp b/src/expr/expr_template.cpp index 9fbdc81d6..6dbc2256c 100644 --- a/src/expr/expr_template.cpp +++ b/src/expr/expr_template.cpp @@ -399,22 +399,22 @@ Expr Expr::substitute(const std::unordered_map map return Expr(d_exprManager, new Node(d_node->substitute(mkNodePairIteratorAdaptor(map.begin()), mkNodePairIteratorAdaptor(map.end())))); } -Expr::const_iterator::const_iterator() : - d_iterator(NULL) { -} -Expr::const_iterator::const_iterator(ExprManager* em, void* v) : - d_exprManager(em), - d_iterator(v) { -} -Expr::const_iterator::const_iterator(const const_iterator& it) { - if(it.d_iterator == NULL) { - d_iterator = NULL; - } else { +Expr::const_iterator::const_iterator() + : d_exprManager(nullptr), d_iterator(nullptr) {} + +Expr::const_iterator::const_iterator(ExprManager* em, void* v) + : d_exprManager(em), d_iterator(v) {} + +Expr::const_iterator::const_iterator(const const_iterator& it) + : d_exprManager(nullptr), d_iterator(nullptr) { + if (it.d_iterator != nullptr) { d_exprManager = it.d_exprManager; ExprManagerScope ems(*d_exprManager); - d_iterator = new Node::iterator(*reinterpret_cast(it.d_iterator)); + d_iterator = + new Node::iterator(*reinterpret_cast(it.d_iterator)); } } + Expr::const_iterator& Expr::const_iterator::operator=(const const_iterator& it) { if(d_iterator != NULL) { ExprManagerScope ems(*d_exprManager);