summaryrefslogtreecommitdiffstats
path: root/src/corelib/json
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-11-25 10:32:29 +0100
committerLiang Qi <liang.qi@qt.io>2016-11-25 10:32:29 +0100
commit50aeedd86ce0244fbb77ebefdce8da72db881e45 (patch)
tree209b0e39b8bde2e43da9497ab327767679ebbdb6 /src/corelib/json
parent08dea594fe4a55d7546a17773f84f44de2c2d200 (diff)
parent17d72c783747dd8d9ce767002988d5d5a54a790e (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: mkspecs/features/qml_module.prf src/corelib/tools/qdatetimeparser_p.h Change-Id: I5382cee3ddb33107dc61ee20f7a9188c4a68a882
Diffstat (limited to 'src/corelib/json')
-rw-r--r--src/corelib/json/qjsonparser.cpp5
-rw-r--r--src/corelib/json/qjsonparser_p.h5
2 files changed, 6 insertions, 4 deletions
diff --git a/src/corelib/json/qjsonparser.cpp b/src/corelib/json/qjsonparser.cpp
index 094cb7a76b..a9655515f4 100644
--- a/src/corelib/json/qjsonparser.cpp
+++ b/src/corelib/json/qjsonparser.cpp
@@ -497,9 +497,10 @@ namespace {
memcpy(newValues, data, size*sizeof(QJsonPrivate::Value));
data = newValues;
} else {
- data = static_cast<QJsonPrivate::Value *>(realloc(data, alloc*sizeof(QJsonPrivate::Value)));
- if (!data)
+ void *newValues = realloc(data, alloc * sizeof(QJsonPrivate::Value));
+ if (!newValues)
return false;
+ data = static_cast<QJsonPrivate::Value *>(newValues);
}
return true;
}
diff --git a/src/corelib/json/qjsonparser_p.h b/src/corelib/json/qjsonparser_p.h
index 920f265ca3..b454c655ac 100644
--- a/src/corelib/json/qjsonparser_p.h
+++ b/src/corelib/json/qjsonparser_p.h
@@ -107,11 +107,12 @@ private:
inline int reserveSpace(int space) {
if (current + space >= dataLength) {
dataLength = 2*dataLength + space;
- data = (char *)realloc(data, dataLength);
- if (!data) {
+ char *newData = (char *)realloc(data, dataLength);
+ if (!newData) {
lastError = QJsonParseError::DocumentTooLarge;
return -1;
}
+ data = newData;
}
int pos = current;
current += space;