Fix bug reported by Valgrind. Reason: m_metavars is a vector of metavar_info; each metavar_info has a context; when we invoke mk_metavar the vector can grow in size, and the context is moved to a new location. The previous location is invalidated. To avoid the problem we have to save ctx in a local variable.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-09-04 04:28:09 -07:00
parent 9522048390
commit 57c0c69872

View file

@ -121,7 +121,8 @@ class elaborator::imp {
if (m_metavars[midx].m_type) {
return m_metavars[midx].m_type;
} else {
expr t = mk_metavar(m_metavars[midx].m_ctx);
context ctx = m_metavars[midx].m_ctx;
expr t = mk_metavar(ctx);
m_metavars[midx].m_type = t;
return t;
}