Ensure that we clear deleted values
When throwing on an invalid value, we may end up freeing the same tree twice. This is generally not an issue but we need to mark the freed memory as null to avoid a double free Fixes https://gitlab.com/kicad/code/kicad/issues/12981
This commit is contained in:
parent
9403b5ce99
commit
62863d6c5b
|
@ -250,6 +250,7 @@ COMPILER::~COMPILER()
|
||||||
if( m_tree )
|
if( m_tree )
|
||||||
{
|
{
|
||||||
freeTree( m_tree );
|
freeTree( m_tree );
|
||||||
|
m_tree = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow explicit call to destructor
|
// Allow explicit call to destructor
|
||||||
|
@ -694,6 +695,7 @@ void COMPILER::freeTree( LIBEVAL::TREE_NODE *tree )
|
||||||
freeTree( tree->leaf[1] );
|
freeTree( tree->leaf[1] );
|
||||||
|
|
||||||
delete tree->uop;
|
delete tree->uop;
|
||||||
|
tree->uop = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue