fix memory leak

When staging a commit for an object that has already been modified,
there is a Clone() made for the hypothetical entry.  We need to free it
if we are not storing a new entry.
This commit is contained in:
Seth Hillbrand 2018-06-27 16:15:27 -07:00
parent d30ac2967a
commit d83cff63f6
1 changed files with 3 additions and 0 deletions

View File

@ -141,7 +141,10 @@ COMMIT& COMMIT::createModified( EDA_ITEM* aItem, EDA_ITEM* aCopy, int aExtraFlag
auto entryIt = m_changedItems.find( parent ); auto entryIt = m_changedItems.find( parent );
if( entryIt != m_changedItems.end() ) if( entryIt != m_changedItems.end() )
{
free( aCopy );
return *this; // item has been already modified once return *this; // item has been already modified once
}
makeEntry( parent, CHT_MODIFY | aExtraFlags, aCopy ); makeEntry( parent, CHT_MODIFY | aExtraFlags, aCopy );