vcl/source/filter/sgvtext.cxx |   16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

New commits:
commit 97d3624d56323431939f28593da405adb1f39480
Author: Takeshi Abe <t...@fixedpoint.jp>
Date:   Sat Jun 13 18:16:33 2015 +0900

    vcl: avoid possible leaks in case of unexpected exceptions
    
    Change-Id: I285fcd1ce10bb97b4541d09a9a242bbd95f5c730
    Reviewed-on: https://gerrit.libreoffice.org/16255
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Noel Grandin <noelgran...@gmail.com>

diff --git a/vcl/source/filter/sgvtext.cxx b/vcl/source/filter/sgvtext.cxx
index b1373c6..575cc3e 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
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to