sal/rtl/strtmpl.hxx |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit 66614d9d1c63ecd957440184e696cd1d71fba96a
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Tue Mar 1 13:50:20 2022 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Tue Mar 1 17:39:16 2022 +0100

    No need to memset the allocated buffer in new_WithLength
    
    Other places that allocate, specifically newFromStr_WithLength and
    ensureCapacity, don't initialize the memory.
    
    Change-Id: Iad5301313312aac24948afefb27925d52fe3c673
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130762
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sal/rtl/strtmpl.hxx b/sal/rtl/strtmpl.hxx
index db2df9a8ad75..78375ae07e26 100644
--- a/sal/rtl/strtmpl.hxx
+++ b/sal/rtl/strtmpl.hxx
@@ -1026,9 +1026,7 @@ void new_WithLength( IMPL_RTL_STRINGDATA** ppThis, 
sal_Int32 nLen )
         *ppThis = Alloc<IMPL_RTL_STRINGDATA>( nLen );
         assert(*ppThis != nullptr);
         (*ppThis)->length   = 0;
-
-        auto* pTempStr = (*ppThis)->buffer;
-        memset(pTempStr, 0, nLen*sizeof(*pTempStr));
+        (*ppThis)->buffer[0] = 0;
     }
 }
 

Reply via email to