summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-12-15 08:48:41 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-12-15 08:48:41 +0100
commit6502c0dd8338c05dc4dab323099bb9062ff3d131 (patch)
treee0a91cf19747990f674f9cdd7dd968d067f14c5a
parentf6d1a15206ac13d3034c0c08722dea6102202354 (diff)
...and this looks like a memory leak, too
Change-Id: I5e203fe8b58d687c0c294c75e385f0bbc858ba07
-rw-r--r--svl/source/items/itemset.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 1ed7246ac47b..a4e2c8a33702 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -20,6 +20,7 @@
#include <string.h>
+#include <cassert>
#include <cstdarg>
#include <libxml/xmlwriter.h>
@@ -452,7 +453,12 @@ const SfxPoolItem* SfxItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich
// Will 'dontcare' or 'disabled' be overwritten with some real value?
if ( rItem.Which() && ( IsInvalidItem(*ppFnd) || !(*ppFnd)->Which() ) )
{
+ auto const old = *ppFnd;
*ppFnd = &m_pPool->Put( rItem, nWhich );
+ if (!IsInvalidItem(old)) {
+ assert(old->Which() == 0);
+ delete old;
+ }
return *ppFnd;
}