From 19d8f160563ec11a72f5cdc47f05905db6867083 Mon Sep 17 00:00:00 2001 From: Pol Henarejos Date: Wed, 19 Oct 2022 16:37:56 +0200 Subject: [PATCH] Clean struct before return. Signed-off-by: trocotronic --- src/fido/credential.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/fido/credential.c b/src/fido/credential.c index 889c3ac..9c36525 100644 --- a/src/fido/credential.c +++ b/src/fido/credential.c @@ -38,7 +38,9 @@ int credential_verify(uint8_t *cred_id, size_t cred_id_len, const uint8_t *rp_id mbedtls_chachapoly_context chatx; mbedtls_chachapoly_init(&chatx); mbedtls_chachapoly_setkey(&chatx, key); - return mbedtls_chachapoly_auth_decrypt(&chatx, cred_id_len - (4 + 12 + 16), iv, rp_id_hash, 32, tag, cipher, cipher); + int ret = mbedtls_chachapoly_auth_decrypt(&chatx, cred_id_len - (4 + 12 + 16), iv, rp_id_hash, 32, tag, cipher, cipher); + mbedtls_chachapoly_free(&chatx); + return ret; } int credential_create(CborCharString *rpId, CborByteString *userId, CborCharString *userName, CborCharString *userDisplayName, CredOptions *opts, CredExtensions *extensions, bool use_sign_count, int alg, int curve, uint8_t *cred_id, size_t *cred_id_len) {