- MMS client: added additional check when parsing read response

pull/244/head
Michael Zillgith 5 years ago
parent 6b52ed440e
commit fe2e5d59fd

@ -79,18 +79,25 @@ mmsClient_parseListOfAccessResults(AccessResult_t** accessResultList, int listSi
value->value.structure.size = arrayElementCount; value->value.structure.size = arrayElementCount;
value->value.structure.components = (MmsValue**) GLOBAL_CALLOC(arrayElementCount, sizeof(MmsValue*)); value->value.structure.components = (MmsValue**) GLOBAL_CALLOC(arrayElementCount, sizeof(MmsValue*));
int j; if (value->value.structure.components) {
int j;
for (j = 0; j < arrayElementCount; j++) { for (j = 0; j < arrayElementCount; j++) {
value->value.structure.components[j] = mmsMsg_parseDataElement( value->value.structure.components[j] = mmsMsg_parseDataElement(
accessResultList[i]->choice.array.list.array[j]); accessResultList[i]->choice.array.list.array[j]);
if (value->value.structure.components[j] == NULL) { if (value->value.structure.components[j] == NULL) {
MmsValue_delete(value);
value = NULL; if (DEBUG_MMS_CLIENT)
break; printf("MMS CLIENT: failed to parse array element %i\n", j);
MmsValue_delete(value);
value = NULL;
break;
}
} }
} }
} }
else { else {
if (DEBUG_MMS_CLIENT) if (DEBUG_MMS_CLIENT)
@ -109,17 +116,24 @@ mmsClient_parseListOfAccessResults(AccessResult_t** accessResultList, int listSi
value->value.structure.size = componentCount; value->value.structure.size = componentCount;
value->value.structure.components = (MmsValue**) GLOBAL_CALLOC(componentCount, sizeof(MmsValue*)); value->value.structure.components = (MmsValue**) GLOBAL_CALLOC(componentCount, sizeof(MmsValue*));
int j; if (value->value.structure.components) {
for (j = 0; j < componentCount; j++) { int j;
value->value.structure.components[j] = mmsMsg_parseDataElement( for (j = 0; j < componentCount; j++) {
accessResultList[i]->choice.structure.list.array[j]); value->value.structure.components[j] = mmsMsg_parseDataElement(
accessResultList[i]->choice.structure.list.array[j]);
if (value->value.structure.components[j] == NULL) { if (value->value.structure.components[j] == NULL) {
MmsValue_delete(value);
value = NULL; if (DEBUG_MMS_CLIENT)
break; printf("MMS CLIENT: failed to parse struct element %i\n", j);
MmsValue_delete(value);
value = NULL;
break;
}
} }
} }
} }
else { else {
if (DEBUG_MMS_CLIENT) if (DEBUG_MMS_CLIENT)

Loading…
Cancel
Save