QCborValue: free container memory in case of parsing failure
Holding on to the memory we've just allocated could only make sense if we supported resuming parsing, but I haven't implemented that feature yet. Pick-to: 6.2 6.3 6.4 Change-Id: I36b24183fbd041179f2ffffd1700cf7e3558040f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
b483c67e0f
commit
16641f625e
@ -1508,14 +1508,18 @@ static inline QCborContainerPrivate *createContainerFromCbor(QCborStreamReader &
|
||||
}
|
||||
|
||||
reader.enterContainer();
|
||||
if (reader.lastError() != QCborError::NoError)
|
||||
if (reader.lastError() != QCborError::NoError) {
|
||||
d->elements.clear();
|
||||
return d;
|
||||
}
|
||||
|
||||
while (reader.hasNext() && reader.lastError() == QCborError::NoError)
|
||||
d->decodeValueFromCbor(reader, remainingRecursionDepth - 1);
|
||||
|
||||
if (reader.lastError() == QCborError::NoError)
|
||||
reader.leaveContainer();
|
||||
else
|
||||
d->elements.squeeze();
|
||||
|
||||
return d;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user