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

Jochen Nitschke j.nitschke+logerrit at ok.de
Sun Jan 22 13:54:47 UTC 2017


 opencl/source/openclwrapper.cxx |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 5301985417557627eb6e67cea26caf9688fd3920
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Sun Jan 22 12:02:39 2017 +0100

    cppcheck: memleak (false positive)
    
    but manage ownership from start
    
    Change-Id: I22d855d89bd93c56fbbcc1fb64e757fc950aa791
    Reviewed-on: https://gerrit.libreoffice.org/33391
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx
index 7b9d3ab..7962893 100644
--- a/opencl/source/openclwrapper.cxx
+++ b/opencl/source/openclwrapper.cxx
@@ -218,16 +218,15 @@ std::vector<std::shared_ptr<osl::File> > binaryGenerated( const char * clFileNam
     assert(pDevID == gpuEnv.mpDevID);
 
     OString fileName = createFileName(gpuEnv.mpDevID, clFileName);
-    osl::File* pNewFile = new osl::File(rtl::OStringToOUString(fileName, RTL_TEXTENCODING_UTF8));
+    auto pNewFile = std::make_shared<osl::File>(rtl::OStringToOUString(fileName, RTL_TEXTENCODING_UTF8));
     if(pNewFile->open(osl_File_OpenFlag_Read) == osl::FileBase::E_None)
     {
-        aGeneratedFiles.push_back(std::shared_ptr<osl::File>(pNewFile));
+        aGeneratedFiles.push_back(pNewFile);
         SAL_INFO("opencl.file", "Opening binary file '" << fileName << "' for reading: success");
     }
     else
     {
         SAL_INFO("opencl.file", "Opening binary file '" << fileName << "' for reading: FAIL");
-        delete pNewFile;
     }
 
     return aGeneratedFiles;


More information about the Libreoffice-commits mailing list