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

Takeshi Abe tabe at fixedpoint.jp
Sun Jan 26 18:40:15 PST 2014


 sw/source/core/doc/doccomp.cxx |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit eeb0ff07ad90936cff16f065680b95f0e4ae7192
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Mon Jan 27 11:08:49 2014 +0900

    Fix memory leaks
    
    Change-Id: Ied2b622d4a1dd20a1b79c270aa7b4828e5c103f2

diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 24b2ae2..c269cee 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -44,6 +44,8 @@
 #include <set>
 #include <cctype>
 
+#include <boost/scoped_array.hpp>
+
 using namespace ::com::sun::star;
 
 using ::std::vector;
@@ -1577,11 +1579,11 @@ void SwCompareData::CheckForChangesInLine( const CompareData& rData,
                               rStt, rEnd );
 
     int nMinLen = std::min( aCmp.GetLen1(), aCmp.GetLen2() );
-    int *pLcsDst = new int[ nMinLen ];
-    int *pLcsSrc = new int[ nMinLen ];
+    boost::scoped_array<int> pLcsDst(new int[ nMinLen ]);
+    boost::scoped_array<int> pLcsSrc(new int[ nMinLen ]);
 
     FastCommonSubseq subseq( aCmp );
-    int nLcsLen = subseq.Find( pLcsDst, pLcsSrc );
+    int nLcsLen = subseq.Find( pLcsDst.get(), pLcsSrc.get() );
     for (int i = 0; i <= nLcsLen; i++)
     {
         // Beginning of inserted lines (inclusive)


More information about the Libreoffice-commits mailing list