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. Change-Id: I36b24183fbd041179f2ffffd1700cf7e3558040f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 16641f625ec0ae71b34813b8eef4dcc1aeb81fc5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
3a27cf4c3d
commit
efc5fa9386
@ -1504,14 +1504,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…
x
Reference in New Issue
Block a user