diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-08-01 14:50:54 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-08-04 12:49:59 +0000 |
commit | 02f0102b8bd7793ddd2fe7a54c46d41b9a608cec (patch) | |
tree | 681ab6c40925a32a71cc6361cf538bced70d7c23 /svx/source/xoutdev | |
parent | 4189b715999bf9ebb0cd04a0c610a7b514e28d1b (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 'svx/source/xoutdev')
-rw-r--r-- | svx/source/xoutdev/xattr.cxx | 16 | ||||
-rw-r--r-- | svx/source/xoutdev/xattrbmp.cxx | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index 109ae972e536..50d9555c48c2 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -1011,7 +1011,7 @@ XLineDashItem* XLineDashItem::checkForUniqueItem( SdrModel* pModel ) const return new XLineDashItem( aUniqueName, aDash ); } - return (XLineDashItem*)this; + return NULL; } // class XLineWidthItem @@ -1365,7 +1365,7 @@ XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const { // if the polygon is empty, check if the name is empty if( aUniqueName.isEmpty() ) - return (XLineStartItem*)this; + return NULL; // force empty name for empty polygons return new XLineStartItem( "", maPolyPolygon ); @@ -1567,7 +1567,7 @@ XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const } } - return (XLineStartItem*)this; + return NULL; } // class XLineEndItem @@ -1650,7 +1650,7 @@ XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const { // if the polygon is empty, check if the name is empty if( aUniqueName.isEmpty() ) - return (XLineEndItem*)this; + return NULL; // force empty name for empty polygons return new XLineEndItem( "", maPolyPolygon ); @@ -1852,7 +1852,7 @@ XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const } } - return (XLineEndItem*)this; + return NULL; } bool XLineEndItem::GetPresentation @@ -2750,7 +2750,7 @@ XFillGradientItem* XFillGradientItem::checkForUniqueItem( SdrModel* pModel ) con return new XFillGradientItem( aUniqueName, aGradient, Which() ); } - return (XFillGradientItem*)this; + return NULL; } // class XFillFloatTransparenceItem - @@ -2858,7 +2858,7 @@ XFillFloatTransparenceItem* XFillFloatTransparenceItem::checkForUniqueItem( SdrM } } - return (XFillFloatTransparenceItem*)this; + return NULL; } // class XHatch @@ -3163,7 +3163,7 @@ XFillHatchItem* XFillHatchItem::checkForUniqueItem( SdrModel* pModel ) const return new XFillHatchItem( aUniqueName, aHatch ); } - return (XFillHatchItem*)this; + return NULL; } // --- form text attributes --- diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx index b7cce270d38a..00466318171d 100644 --- a/svx/source/xoutdev/xattrbmp.cxx +++ b/svx/source/xoutdev/xattrbmp.cxx @@ -549,7 +549,7 @@ XFillBitmapItem* XFillBitmapItem::checkForUniqueItem( SdrModel* pModel ) const } } - return (XFillBitmapItem*)this; + return NULL; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |