diff options
author | Tim King <taking@cs.nyu.edu> | 2017-09-25 23:51:42 -0700 |
---|---|---|
committer | Andres Noetzli <andres.noetzli@gmail.com> | 2017-09-25 23:51:42 -0700 |
commit | 75728d632b9ce5d8c75bbf208ef788bf7ce78f9e (patch) | |
tree | 63c5570decde2fa24617599fe52b58b566d9531a /src/expr | |
parent | 25e598ed369ee2cc6227dbfb67f7d38303a7144a (diff) |
Fixing CIDs 1172012 and 1172011: Initiallzing d_exprManager to nullptr in const_iterator. (#1140)
Diffstat (limited to 'src/expr')
-rw-r--r-- | src/expr/expr_template.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
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<Expr, Expr, ExprHashFunction> 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<Node::iterator*>(it.d_iterator)); + d_iterator = + new Node::iterator(*reinterpret_cast<Node::iterator*>(it.d_iterator)); } } + Expr::const_iterator& Expr::const_iterator::operator=(const const_iterator& it) { if(d_iterator != NULL) { ExprManagerScope ems(*d_exprManager); |