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

Takeshi Abe tabe at fixedpoint.jp
Wed Jun 28 07:32:45 UTC 2017


 connectivity/source/drivers/dbase/DTable.cxx |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 7931ef2abbcef22de5cdddd26738e4dd8d1d8ca5
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Wed Jun 28 12:08:22 2017 +0900

    connectivity: Fix memory leak at finding non-empty file
    
    Change-Id: I7134dc4efb9a659727474a788dce19fcb8ea2da7
    Reviewed-on: https://gerrit.libreoffice.org/39338
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index 97bed39062b8..6da1f893e6fc 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -55,6 +55,7 @@
 
 #include <algorithm>
 #include <cassert>
+#include <memory>
 
 using namespace ::comphelper;
 using namespace connectivity;
@@ -1057,13 +1058,10 @@ bool ODbaseTable::CreateImpl()
         if (aContent.isDocument())
         {
             // Only if the file exists with length > 0 raise an error
-            SvStream* pFileStream = createStream_simpleError( aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::READ);
+            std::unique_ptr<SvStream> pFileStream(createStream_simpleError( aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::READ));
 
             if (pFileStream && pFileStream->Seek(STREAM_SEEK_TO_END))
-            {
                 return false;
-            }
-            delete pFileStream;
         }
     }
     catch(const Exception&) // an exception is thrown when no file exists


More information about the Libreoffice-commits mailing list