summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-03-01 13:50:20 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2022-03-01 17:39:16 +0100
commit66614d9d1c63ecd957440184e696cd1d71fba96a (patch)
tree73fbcf1e5170328ce43be8cedffc2d5eec146e74 /sal
parent6c17a51c0f6f2bf9e8c1132a2d1c96edb404e522 (diff)
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.kaganski@collabora.com>
Diffstat (limited to 'sal')
-rw-r--r--sal/rtl/strtmpl.hxx4
1 files changed, 1 insertions, 3 deletions
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;
}
}