diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index a6bb6afe57..32834ebd7e 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -3886,7 +3886,7 @@ QByteArray QByteArray::fromRawData(const char *data, int size) } else if (!size) { x = shared_empty.data_ptr(); } else { - x = static_cast(malloc(sizeof(Data) + 1)); + x = static_cast(malloc(sizeof(Data))); Q_CHECK_PTR(x); x->ref.initializeOwned(); x->size = size; diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 5e69a13057..710aec931a 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -7438,7 +7438,7 @@ QString QString::fromRawData(const QChar *unicode, int size) } else if (!size) { x = shared_empty.data_ptr(); } else { - x = static_cast(::malloc(sizeof(Data) + sizeof(ushort))); + x = static_cast(::malloc(sizeof(Data))); Q_CHECK_PTR(x); x->ref.initializeOwned(); x->size = size;