diff --git a/os_stub/spdm_device_secret_lib_sample/key_pair.c b/os_stub/spdm_device_secret_lib_sample/key_pair.c index cc47b3d5caa..1ddf4f3dc84 100644 --- a/os_stub/spdm_device_secret_lib_sample/key_pair.c +++ b/os_stub/spdm_device_secret_lib_sample/key_pair.c @@ -471,6 +471,7 @@ bool libspdm_write_key_pair_info( m_key_pair_info[key_pair_id - 1].assoc_cert_slot_mask = desired_assoc_cert_slot_mask; } else { + free(cached_key_pair_info); return false; } diff --git a/unit_test/spdm_unit_test_common/event_support.c b/unit_test/spdm_unit_test_common/event_support.c index deb6a384a4c..052448003d7 100644 --- a/unit_test/spdm_unit_test_common/event_support.c +++ b/unit_test/spdm_unit_test_common/event_support.c @@ -136,6 +136,9 @@ void generate_dmtf_event_data(void *buffer, uint8_t *total_bytes, uint32_t event case SPDM_DMTF_EVENT_TYPE_CERTIFICATE_CHANGED: event_detail_len = SPDM_DMTF_EVENT_TYPE_CERTIFICATE_CHANGED_SIZE; break; + default: + event_detail_len = 0; + assert(false); } event_data->event_detail_len = event_detail_len; diff --git a/unit_test/spdm_unit_test_common/support.c b/unit_test/spdm_unit_test_common/support.c index 8ababd147dc..7c5a78121da 100644 --- a/unit_test/spdm_unit_test_common/support.c +++ b/unit_test/spdm_unit_test_common/support.c @@ -107,6 +107,7 @@ bool libspdm_read_input_file(const char *file_name, void **file_data, if (temp_result == -1) { printf("Unable to open file %s\n", file_name); *file_data = NULL; + close(fp_in); return false; } else { *file_size = (size_t)temp_result;