[Libreoffice-commits] core.git: svl/source

Stephan Bergmann sbergman at redhat.com
Mon Dec 14 23:49:10 PST 2015


 svl/source/items/itemset.cxx |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit 6502c0dd8338c05dc4dab323099bb9062ff3d131
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Dec 15 08:48:41 2015 +0100

    ...and this looks like a memory leak, too
    
    Change-Id: I5e203fe8b58d687c0c294c75e385f0bbc858ba07

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 1ed7246..a4e2c8a 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;
                 }
 


More information about the Libreoffice-commits mailing list