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
(cherry picked from commit 62863d6c5b
)
This commit is contained in:
parent
3b3e86b968
commit
554d82b2a4
|
@ -249,6 +249,7 @@ COMPILER::~COMPILER()
|
|||
if( m_tree )
|
||||
{
|
||||
freeTree( m_tree );
|
||||
m_tree = nullptr;
|
||||
}
|
||||
|
||||
// Allow explicit call to destructor
|
||||
|
@ -693,6 +694,7 @@ void COMPILER::freeTree( LIBEVAL::TREE_NODE *tree )
|
|||
freeTree( tree->leaf[1] );
|
||||
|
||||
delete tree->uop;
|
||||
tree->uop = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue