summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-10-05 08:12:58 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-10-05 15:18:16 +0200
commit17915ab5202a4d7456e9bc031c3f6a72bc861844 (patch)
tree1f7e2ac548dd536c2e389e4b964c4b5c8b939df2 /svl
parent74650680788dc076a37d2fe4d5f9237c450807d0 (diff)
fix ubsan alloc-dealloc-mismatch
after commit 503ab1ca9ae11978d9717557546c01ff598aaf88 Author: Noel Grandin <noelgrandin@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.grandin@collabora.co.uk>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/items/itemset.cxx2
1 files changed, 1 insertions, 1 deletions
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)