Browse Source

message_codec: add free_ASN1Message, for name symmetry

Use it.
ENGINE-971
Luca Saiu 8 months ago
parent
commit
4c6d5a1535
4 changed files with 24 additions and 5 deletions
  1. +1
    -1
      src/map_asn1.c
  2. +8
    -2
      src/message_codec.c
  3. +13
    -0
      src/message_codec.h
  4. +2
    -2
      test/src/MapAsn1Test.cc

+ 1
- 1
src/map_asn1.c View File

@ -1073,7 +1073,7 @@ ASN1Message_t *ASN1Message_from_message(
enomem:
if (allocated)
ASN_STRUCT_FREE(asn_DEF_ASN1Message, result);
free_ASN1Message(result);
return NULL;
}


+ 8
- 2
src/message_codec.c View File

@ -98,7 +98,7 @@ PEP_STATUS PER_to_XER_ASN1Message_msg(
the_end:
free_growing_buf(dst);
ASN_STRUCT_FREE(asn_DEF_ASN1Message, msg);
free_ASN1Message(msg);
return status;
}
@ -135,7 +135,13 @@ PEP_STATUS XER_to_PER_ASN1Message_msg(
*size = (size_t) _size;
the_end:
ASN_STRUCT_FREE(asn_DEF_ASN1Message, msg);
free_ASN1Message(msg);
return status;
}
DYNAMIC_API void free_ASN1Message(
ASN1Message_t *msg
)
{
ASN_STRUCT_FREE(asn_DEF_ASN1Message, msg);
}

+ 13
- 0
src/message_codec.h View File

@ -96,6 +96,19 @@ DYNAMIC_API PEP_STATUS XER_to_PER_ASN1Message_msg(
);
/**
* <!-- free_ASN1Message() -->
*
* @brief De-allocate the pointed ASN1 message which must have been
* heap-allocated.
*
* @param[in] msg Pointer to the message to destroy.
*/
DYNAMIC_API void free_ASN1Message(
ASN1Message_t *msg
);
#ifdef __cplusplus
}
#endif


+ 2
- 2
test/src/MapAsn1Test.cc View File

@ -194,8 +194,8 @@ TEST_F(MapAsn1Test, check_map_asn1_message) {
ASSERT_STREQ(msg2->opt_fields->next->value->value, "othervalue");
ASSERT_STREQ(msg2->_sender_fpr, "2342234223422342");
ASN_STRUCT_FREE(asn_DEF_ASN1Message, pm);
ASN_STRUCT_FREE(asn_DEF_ASN1Message, pm2);
free_ASN1Message(pm);
free_ASN1Message(pm2);
free_message(msg);
free_message(msg2);
free(data);


Loading…
Cancel
Save