From d83cff63f682964b53e3d936609f2dd2d688ee9c Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Wed, 27 Jun 2018 16:15:27 -0700 Subject: [PATCH] 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. --- common/commit.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/commit.cpp b/common/commit.cpp index 6939539b0e..c5593d4937 100644 --- a/common/commit.cpp +++ b/common/commit.cpp @@ -141,7 +141,10 @@ COMMIT& COMMIT::createModified( EDA_ITEM* aItem, EDA_ITEM* aCopy, int aExtraFlag auto entryIt = m_changedItems.find( parent ); if( entryIt != m_changedItems.end() ) + { + free( aCopy ); return *this; // item has been already modified once + } makeEntry( parent, CHT_MODIFY | aExtraFlags, aCopy );