diff options
author | Mark Wielaard <mark@klomp.org> | 2013-06-30 17:03:37 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-07-01 12:26:09 +0000 |
commit | 2fc0fa62b26ce34675fcb94de59194592421eeb5 (patch) | |
tree | b7927e4e5be38de89770e0b64e60cc5c0977cbc4 /io | |
parent | 5c3f673c1ff25c835da6b905a63b36087aaa405e (diff) |
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@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'io')
-rw-r--r-- | io/source/TextInputStream/TextInputStream.cxx | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/io/source/TextInputStream/TextInputStream.cxx b/io/source/TextInputStream/TextInputStream.cxx index ff734fa0148f..0d6645d7d0ba 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; } |