diff options
Diffstat (limited to 'common/src/tfe_cmsg.cpp')
| -rw-r--r-- | common/src/tfe_cmsg.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/common/src/tfe_cmsg.cpp b/common/src/tfe_cmsg.cpp index 3823c32..1d934f2 100644 --- a/common/src/tfe_cmsg.cpp +++ b/common/src/tfe_cmsg.cpp @@ -62,6 +62,17 @@ int tfe_cmsg_set(struct tfe_cmsg * cmsg, enum tfe_cmsg_tlv_type type, const unsi } struct tfe_cmsg_tlv *tlv = cmsg->tlvs[type]; uint16_t length = sizeof(struct tfe_cmsg_tlv) + size; + + // If the current tlv has been set, the previous value will be overwritten + if (NULL != tlv) + { + cmsg->nr_tlvs--; + cmsg->size -= tlv->length; + cmsg->tlvs[type] = NULL; + free(tlv); + tlv = NULL; + } + if(tlv == NULL) { tlv = (struct tfe_cmsg_tlv*)ALLOC(char, length); |
