From 9eb2b25300c21df2abd9b174c1077a377a42fcd1 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 19 Sep 2014 16:11:51 +0200 Subject: 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 Reviewed-by: Marc Mutz --- src/corelib/tools/qarraydata.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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); } -- cgit v1.2.3