summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qbytearray.cpp
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2012-04-04 14:24:01 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-05 01:45:24 +0200
commitb3f12ea1d40b33e459c95317911251b8a8d5c3f8 (patch)
tree928faeb6ff9d798d8d856aa09b0c48f651c128ff /src/corelib/tools/qbytearray.cpp
parent98e50a18eda614caeadaeb7a05fc2f5ab4f735e7 (diff)
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>
Diffstat (limited to 'src/corelib/tools/qbytearray.cpp')
-rw-r--r--src/corelib/tools/qbytearray.cpp2
1 files changed, 1 insertions, 1 deletions
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<Data *>(malloc(sizeof(Data) + 1));
+ x = static_cast<Data *>(malloc(sizeof(Data)));
Q_CHECK_PTR(x);
x->ref.initializeOwned();
x->size = size;