diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2016-11-15 11:26:34 +0100 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2016-11-15 10:46:20 +0000 |
commit | 59c9993a6a0d25904d278aabafa9be767e977b77 (patch) | |
tree | 66c9d0fae541b39a353a571e09479a4837762800 | |
parent | 8ff69297eeddc3f5650c4cc5517c7e2eafaf6c59 (diff) |
QML: Check for failing realloc/malloc in the QmlJS memory pool
This should make (properly functioning) static code checkers stop
complaining.
Task-number: QTBUG-57025
Change-Id: Ic7e6f1b0b02f2e9324dbc891ab4620d53d9f9a18
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | src/qml/parser/qqmljsmemorypool_p.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/qml/parser/qqmljsmemorypool_p.h b/src/qml/parser/qqmljsmemorypool_p.h index ae9f1d8257..a08e91f2c3 100644 --- a/src/qml/parser/qqmljsmemorypool_p.h +++ b/src/qml/parser/qqmljsmemorypool_p.h @@ -116,6 +116,7 @@ private: _allocatedBlocks *= 2; _blocks = (char **) realloc(_blocks, sizeof(char *) * _allocatedBlocks); + Q_CHECK_PTR(_blocks); for (int index = _blockCount; index < _allocatedBlocks; ++index) _blocks[index] = 0; @@ -123,8 +124,10 @@ private: char *&block = _blocks[_blockCount]; - if (! block) + if (! block) { block = (char *) malloc(BLOCK_SIZE); + Q_CHECK_PTR(block); + } _ptr = block; _end = _ptr + BLOCK_SIZE; |