qjson: add missed Q_CHECK_PTR
There might be dereferencing of a potential null pointer 'h' Task-number: QTBUG-71156 Change-Id: I63c34f8cba3e358f109d70ff9b34199c31895202 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>bb10
parent
9ef793ba95
commit
c6c31b14a7
|
|
@ -70,6 +70,7 @@ void Data::compact()
|
|||
int size = sizeof(Base) + reserve + base->length*sizeof(offset);
|
||||
int alloc = sizeof(Header) + size;
|
||||
Header *h = (Header *) malloc(alloc);
|
||||
Q_CHECK_PTR(h);
|
||||
h->tag = QJsonDocument::BinaryFormatTag;
|
||||
h->version = 1;
|
||||
Base *b = h->root();
|
||||
|
|
|
|||
|
|
@ -304,6 +304,7 @@ QJsonDocument Parser::parse(QJsonParseError *error)
|
|||
// allocate some space
|
||||
dataLength = qMax(end - json, (ptrdiff_t) 256);
|
||||
data = (char *)malloc(dataLength);
|
||||
Q_CHECK_PTR(data);
|
||||
|
||||
// fill in Header data
|
||||
QJsonPrivate::Header *h = (QJsonPrivate::Header *)data;
|
||||
|
|
|
|||
Loading…
Reference in New Issue