summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qobject.cpp7
-rw-r--r--src/corelib/kernel/qobject_p.h3
2 files changed, 5 insertions, 5 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 980fefc4eae..aa429636bd3 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -622,7 +622,7 @@ QQueuedMetaCallEvent::~QQueuedMetaCallEvent()
}
if (d.nargs_) {
if (static_cast<void *>(d.args_) != prealloc_)
- free(d.args_);
+ QtPrivate::sizedFree(d.args_, d.nargs_, PtrAndTypeSize);
}
}
@@ -634,9 +634,8 @@ inline void QQueuedMetaCallEvent::allocArgs()
if (!d.nargs_)
return;
- constexpr size_t each = sizeof(void*) + sizeof(QMetaType);
- void *const memory = d.nargs_ * each > sizeof(prealloc_) ?
- calloc(d.nargs_, each) : prealloc_;
+ void *const memory = d.nargs_ * PtrAndTypeSize > sizeof(prealloc_) ?
+ calloc(d.nargs_, PtrAndTypeSize) : prealloc_;
Q_CHECK_PTR(memory);
d.args_ = static_cast<void **>(memory);
diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h
index be3e8f58f09..72d00ead769 100644
--- a/src/corelib/kernel/qobject_p.h
+++ b/src/corelib/kernel/qobject_p.h
@@ -406,7 +406,8 @@ private:
// Space for 5 argument pointers and types (including 1 return arg).
// Contiguous so that we can make one calloc() for both the pointers and the types when necessary.
- alignas(void *) char prealloc_[5 * sizeof(void *) + 5 * sizeof(QMetaType)];
+ static constexpr size_t PtrAndTypeSize = sizeof(void *) + sizeof(QMetaType);
+ alignas(void *) char prealloc_[5 * PtrAndTypeSize];
struct ArgValueStorage { // size and alignment matching QString, QList, etc
static constexpr size_t MaxSize = 3 * sizeof(void *);
alignas(void *) char storage[MaxSize];