From aacada4135036ffd7addfe8195de979d4d9c5b6b Mon Sep 17 00:00:00 2001 From: emanuel Date: Wed, 22 Jun 2022 16:33:40 +0100 Subject: [PATCH] Clean stored TPM entry proof if encoding fails --- src/tpm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tpm.c b/src/tpm.c index b92ba16..bd439a5 100644 --- a/src/tpm.c +++ b/src/tpm.c @@ -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); if (e_tep.encoded == -1) { 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; goto cleanup; }