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

Mark Wielaard mark at klomp.org
Mon Jul 1 05:26:31 PDT 2013


 io/source/TextInputStream/TextInputStream.cxx |    3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 2fc0fa62b26ce34675fcb94de59194592421eeb5
Author: Mark Wielaard <mark at klomp.org>
Date:   Sun Jun 30 17:03:37 2013 +0200

    Fix memory leak in OTextInputStream.
    
    Delete mpBuffer when done in destructor or replaced in implResizeBuffer.
    
    Change-Id: Ide1b44f10a482ce9bb6135fb879e62e0a8ccea29
    Reviewed-on: https://gerrit.libreoffice.org/4637
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/io/source/TextInputStream/TextInputStream.cxx b/io/source/TextInputStream/TextInputStream.cxx
index ff734fa..0d6645d 100644
--- a/io/source/TextInputStream/TextInputStream.cxx
+++ b/io/source/TextInputStream/TextInputStream.cxx
@@ -128,6 +128,8 @@ OTextInputStream::~OTextInputStream()
         rtl_destroyUnicodeToTextContext( mConvText2Unicode, mContextText2Unicode );
         rtl_destroyUnicodeToTextConverter( mConvText2Unicode );
     }
+
+    delete[] mpBuffer;
 }
 
 void OTextInputStream::implResizeBuffer( void )
@@ -135,6 +137,7 @@ void OTextInputStream::implResizeBuffer( void )
     sal_Int32 mnNewBufferSize = mnBufferSize * 2;
     sal_Unicode* pNewBuffer = new sal_Unicode[ mnNewBufferSize ];
     memcpy( pNewBuffer, mpBuffer, mnCharsInBuffer * sizeof( sal_Unicode ) );
+    delete[] mpBuffer;
     mpBuffer = pNewBuffer;
     mnBufferSize = mnNewBufferSize;
 }


More information about the Libreoffice-commits mailing list