svl/source/items/itemset.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
New commits: commit 17915ab5202a4d7456e9bc031c3f6a72bc861844 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Tue Oct 5 08:12:58 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Oct 5 15:18:16 2021 +0200 fix ubsan alloc-dealloc-mismatch after commit 503ab1ca9ae11978d9717557546c01ff598aaf88 Author: Noel Grandin <noelgran...@gmail.com> Date: Sat Oct 2 16:28:56 2021 +0200 Use placement new to avoid one of the allocation calls... Change-Id: I2eb85c5c1be5d2eaf757d717f03873415e49c9a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123083 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx index bd63de62f586..3b47719dbf04 100644 --- a/svl/source/items/itemset.cxx +++ b/svl/source/items/itemset.cxx @@ -1267,7 +1267,7 @@ std::unique_ptr<SfxItemSet> SfxItemSet::Clone(bool bItems, SfxItemPool *pToPool // Use placement new to avoid one of the allocation calls when constructing a new SfxItemSet. // This is effectively a run-time equivalent of the SfxItemSetFixed template. const int cnt = TotalCount(); - char* p = new char[sizeof(SfxItemSet) + (sizeof(const SfxPoolItem*) * cnt)]; + char* p = static_cast<char*>(::operator new(sizeof(SfxItemSet) + (sizeof(const SfxPoolItem*) * cnt))); SfxItemSet* pNewItemSet = reinterpret_cast<SfxItemSet*>(p); const SfxPoolItem** ppNewItems = reinterpret_cast<const SfxPoolItem **>(p + sizeof(SfxItemSet)); if (pToPool && pToPool != m_pPool)