From 074cee0cbca52dbe2760883c4ade2b1879e69cc4 Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Wed, 22 Jul 2020 09:43:00 +0200 Subject: [PATCH] - MMS client: fixed potential problem in multi-variable write response parsing --- src/iec61850/client/client_goose_control.c | 1 + src/mms/iso_mms/client/mms_client_write.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/iec61850/client/client_goose_control.c b/src/iec61850/client/client_goose_control.c index 7873818b..7fa44444 100644 --- a/src/iec61850/client/client_goose_control.c +++ b/src/iec61850/client/client_goose_control.c @@ -589,6 +589,7 @@ IedConnection_setGoCBValues(IedConnection self, IedClientError* error, ClientGoo } *error = iedConnection_mapMmsErrorToIedError(mmsError); + goto exit_function; } else { diff --git a/src/mms/iso_mms/client/mms_client_write.c b/src/mms/iso_mms/client/mms_client_write.c index e1e62239..e99a6e1b 100644 --- a/src/mms/iso_mms/client/mms_client_write.c +++ b/src/mms/iso_mms/client/mms_client_write.c @@ -132,8 +132,12 @@ mmsClient_parseWriteMultipleItemsResponse(ByteBuffer* message, int32_t bufPos, M exit_with_error: *mmsError = MMS_ERROR_PARSING_RESPONSE; - if (accessResults != NULL) - LinkedList_destroyDeep(*accessResults, (LinkedListValueDeleteFunction) MmsValue_delete); + if (accessResults != NULL) { + if (*accessResults) { + LinkedList_destroyDeep(*accessResults, (LinkedListValueDeleteFunction) MmsValue_delete); + *accessResults = NULL; + } + } }