diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2015-06-13 18:16:33 +0900 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-06-15 06:56:45 +0000 |
commit | 97d3624d56323431939f28593da405adb1f39480 (patch) | |
tree | fcd6364431ef74e749abaaa3a503f95f7883284a /vcl/source/filter/sgvtext.cxx | |
parent | b544b651ca4d40bae8f11d0daec113a138f5d17d (diff) |
vcl: avoid possible leaks in case of unexpected exceptions
Change-Id: I285fcd1ce10bb97b4541d09a9a242bbd95f5c730
Reviewed-on: https://gerrit.libreoffice.org/16255
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'vcl/source/filter/sgvtext.cxx')
-rw-r--r-- | vcl/source/filter/sgvtext.cxx | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/vcl/source/filter/sgvtext.cxx b/vcl/source/filter/sgvtext.cxx index b1373c6fdd51..575cc3e2104b 100644 --- a/vcl/source/filter/sgvtext.cxx +++ b/vcl/source/filter/sgvtext.cxx @@ -29,6 +29,7 @@ #include "sgfbram.hxx" #include "sgvmain.hxx" #include <boost/scoped_array.hpp> +#include <memory> extern SgfFontLst* pSgfFonts; @@ -667,13 +668,13 @@ void FormatLine(UCHAR* TBuf, sal_uInt16& Index, ObjTextType& Atr0, ObjTextType& bool Border; // border of box reached ? bool Border0; bool AbsEnd; // end of paragraph reached ? - ProcChrSta* R=new ProcChrSta; - ProcChrSta* R0=new ProcChrSta; - ProcChrSta* WErec=new ProcChrSta; + std::unique_ptr<ProcChrSta> R(new ProcChrSta); + std::unique_ptr<ProcChrSta> R0(new ProcChrSta); + std::unique_ptr<ProcChrSta> WErec(new ProcChrSta); sal_uInt16 WEnChar; - ProcChrSta* WErec0=new ProcChrSta; + std::unique_ptr<ProcChrSta> WErec0(new ProcChrSta); sal_uInt16 WEnChar0; - ProcChrSta* TRrec=new ProcChrSta; + std::unique_ptr<ProcChrSta> TRrec(new ProcChrSta); sal_uInt16 TRnChar; sal_uInt16 WordEndCnt; // justify and separate @@ -852,11 +853,6 @@ void FormatLine(UCHAR* TBuf, sal_uInt16& Index, ObjTextType& Atr0, ObjTextType& } Index=R->Index; AktAtr=R->Attrib; - delete R; - delete R0; - delete WErec; - delete WErec0; - delete TRrec; } // End of Absatz.Pas |