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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Fri Apr 26 20:11:41 UTC 2019


 emfio/source/reader/emfreader.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit b380c82491593d783ecd5469feda0220ec264db3
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Apr 26 17:15:26 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Apr 26 22:09:31 2019 +0200

    Avoid manual malloc/free
    
    Change-Id: I7420dfde91ab52316139b446ea5c5aac79ed2350
    Reviewed-on: https://gerrit.libreoffice.org/71380
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx
index 574858ccd67d..51a8a6fb029b 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -406,9 +406,9 @@ namespace emfio
 
         mbEMFPlus = true;
         sal_uInt64 const pos = mpInputStream->Tell();
-        void *buffer = malloc( length );
-        PassEMFPlus( buffer, mpInputStream->ReadBytes(buffer, length) );
-        free( buffer );
+        auto buffer = std::make_unique<char[]>( length );
+        PassEMFPlus( buffer.get(), mpInputStream->ReadBytes(buffer.get(), length) );
+        buffer.reset();
         mpInputStream->Seek( pos );
 
         bHaveDC = false;


More information about the Libreoffice-commits mailing list