summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qbytearray.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h
index b0a6971964..0a2f7a9e53 100644
--- a/src/corelib/tools/qbytearray.h
+++ b/src/corelib/tools/qbytearray.h
@@ -462,7 +462,7 @@ inline int QByteArray::capacity() const
inline void QByteArray::reserve(int asize)
{
if (d->ref.isShared() || uint(asize) + 1u > d->alloc) {
- reallocData(uint(asize) + 1u, d->detachFlags() | Data::CapacityReserved);
+ reallocData(qMax(uint(size()), uint(asize)) + 1u, d->detachFlags() | Data::CapacityReserved);
} else {
// cannot set unconditionally, since d could be the shared_null or
// otherwise static