Clean stored TPM entry proof if encoding fails

This commit is contained in:
emanuel 2022-06-22 16:33:40 +01:00
parent 4caa1f5d51
commit aacada4135
1 changed files with 2 additions and 0 deletions

View File

@ -141,6 +141,8 @@ int tpm_pay(void* fc, tolling_info_t* info, void* security_socket, uint8_t* neig
asn_enc_rval_t e_tep = uper_encode_to_buffer(&asn_DEF_TPM, NULL, tolling->station.obu.entry_proof, b_tep, 1024); asn_enc_rval_t e_tep = uper_encode_to_buffer(&asn_DEF_TPM, NULL, tolling->station.obu.entry_proof, b_tep, 1024);
if (e_tep.encoded == -1) { if (e_tep.encoded == -1) {
syslog_err("[facilities] [tolling] error encoding TPM entry proof (%s)", e_tep.failed_type->name); syslog_err("[facilities] [tolling] error encoding TPM entry proof (%s)", e_tep.failed_type->name);
ASN_STRUCT_FREE(asn_DEF_TPM, tolling->station.obu.entry_proof);
tolling->station.obu.entry_proof = NULL;
rv = 1; rv = 1;
goto cleanup; goto cleanup;
} }