Minor error handling fix -- udataType is QCBOR_TYPE_NONE when QCBORDecode_GetNext fails
diff --git a/src/qcbor_decode.c b/src/qcbor_decode.c
index a5d81ac..4d8027c 100644
--- a/src/qcbor_decode.c
+++ b/src/qcbor_decode.c
@@ -733,6 +733,8 @@
uint64_t uNumber;
uint8_t uAdditionalInfo;
+ memset(pDecodedItem, 0, sizeof(QCBORItem));
+
nReturn = DecodeTypeAndNumber(pUInBuf, &uMajorType, &uNumber, &uAdditionalInfo);
// Error out here if we got into trouble on the type and number.
@@ -741,8 +743,6 @@
goto Done;
}
- memset(pDecodedItem, 0, sizeof(QCBORItem));
-
// At this point the major type and the value are valid. We've got the type and the number that
// starts every CBOR data item.
switch (uMajorType) {