summaryrefslogtreecommitdiff
path: root/chart2/source/controller/itemsetwrapper
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-08-01 14:50:54 +0200
committerMichael Stahl <mstahl@redhat.com>2014-08-04 12:49:59 +0000
commit02f0102b8bd7793ddd2fe7a54c46d41b9a608cec (patch)
tree681ab6c40925a32a71cc6361cf538bced70d7c23 /chart2/source/controller/itemsetwrapper
parent4189b715999bf9ebb0cd04a0c610a7b514e28d1b (diff)
prevent memory leak
Found by Lsan. Returning this or a heap allocated object asks for trouble. Let the caller handle it and return null instead of this. Change-Id: I7586e103bef5a8c2727adfe214b052d6962d4467 Reviewed-on: https://gerrit.libreoffice.org/10716 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'chart2/source/controller/itemsetwrapper')
-rw-r--r--chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx20
1 files changed, 16 insertions, 4 deletions
diff --git a/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx b/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx
index b0d6da8cc843..565aafd27cd9 100644
--- a/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx
@@ -324,7 +324,10 @@ void GraphicPropertyItemConverter::FillSpecialItem(
// that the correct entry is chosen in the list of UI-names
XLineDashItem* pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel );
- rOutItemSet.Put( *pItemToPut );
+ if(pItemToPut)
+ rOutItemSet.Put( *pItemToPut );
+ else
+ rOutItemSet.Put(aItem);
}
break;
@@ -347,7 +350,10 @@ void GraphicPropertyItemConverter::FillSpecialItem(
// that the correct entry is chosen in the list of UI-names
XFillGradientItem* pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel );
- rOutItemSet.Put( *pItemToPut );
+ if(pItemToPut)
+ rOutItemSet.Put( *pItemToPut );
+ else
+ rOutItemSet.Put(aItem);
}
break;
@@ -370,7 +376,10 @@ void GraphicPropertyItemConverter::FillSpecialItem(
// that the correct entry is chosen in the list of UI-names
XFillHatchItem* pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel );
- rOutItemSet.Put( *pItemToPut );
+ if(pItemToPut)
+ rOutItemSet.Put( *pItemToPut );
+ else
+ rOutItemSet.Put(aItem);
}
break;
@@ -388,7 +397,10 @@ void GraphicPropertyItemConverter::FillSpecialItem(
// that the correct entry is chosen in the list of UI-names
XFillBitmapItem* pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel );
- rOutItemSet.Put( *pItemToPut );
+ if(pItemToPut)
+ rOutItemSet.Put( *pItemToPut );
+ else
+ rOutItemSet.Put(aItem);
}
break;