diff options
author | Ulf Hermann <ulf.hermann@digia.com> | 2014-09-19 16:11:51 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2014-10-17 10:00:42 +0200 |
commit | 9eb2b25300c21df2abd9b174c1077a377a42fcd1 (patch) | |
tree | 0b9a0cdb402293d514ae447974809786521b9210 /src | |
parent | 9d44645eae144fcfefa0de2455d41f04d29c40d4 (diff) |
Don't dereference pointers on QArrayData deallocation
If the allocation fails the pointer will be 0. That is OK for free(),
but we shouldn't try to check for static data then.
Change-Id: I0a8860c9e04833e3be79f7a8a39bdaffeb488f35
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qarraydata.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/tools/qarraydata.cpp b/src/corelib/tools/qarraydata.cpp index 98c484c1dd..b6f4b3202b 100644 --- a/src/corelib/tools/qarraydata.cpp +++ b/src/corelib/tools/qarraydata.cpp @@ -118,7 +118,8 @@ void QArrayData::deallocate(QArrayData *data, size_t objectSize, return; #endif - Q_ASSERT_X(!data->ref.isStatic(), "QArrayData::deallocate", "Static data can not be deleted"); + Q_ASSERT_X(data == 0 || !data->ref.isStatic(), "QArrayData::deallocate", + "Static data can not be deleted"); ::free(data); } |