Don't allocate space for null when using fromRawData
In this case we only need to allocate space for the "header" data. Change-Id: I059627e47a5bae7a02c82d837c826a6ed0fd20fd Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
98e50a18ed
commit
b3f12ea1d4
|
|
@ -3886,7 +3886,7 @@ QByteArray QByteArray::fromRawData(const char *data, int size)
|
|||
} else if (!size) {
|
||||
x = shared_empty.data_ptr();
|
||||
} else {
|
||||
x = static_cast<Data *>(malloc(sizeof(Data) + 1));
|
||||
x = static_cast<Data *>(malloc(sizeof(Data)));
|
||||
Q_CHECK_PTR(x);
|
||||
x->ref.initializeOwned();
|
||||
x->size = size;
|
||||
|
|
|
|||
|
|
@ -7438,7 +7438,7 @@ QString QString::fromRawData(const QChar *unicode, int size)
|
|||
} else if (!size) {
|
||||
x = shared_empty.data_ptr();
|
||||
} else {
|
||||
x = static_cast<Data *>(::malloc(sizeof(Data) + sizeof(ushort)));
|
||||
x = static_cast<Data *>(::malloc(sizeof(Data)));
|
||||
Q_CHECK_PTR(x);
|
||||
x->ref.initializeOwned();
|
||||
x->size = size;
|
||||
|
|
|
|||
Loading…
Reference in New Issue