From 11e2a9cbfb012020793eb7376f48a8e088ed2f9e Mon Sep 17 00:00:00 2001 From: viveks Date: Thu, 8 Feb 2024 17:24:49 +0530 Subject: [PATCH] Added fido_cred_clean_attobj to clean attestation object --- src/cred.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/cred.c b/src/cred.c index cf5a8032..85a72e17 100644 --- a/src/cred.c +++ b/src/cred.c @@ -549,6 +549,15 @@ fido_cred_clean_attstmt(fido_attstmt_t *attstmt) memset(attstmt, 0, sizeof(*attstmt)); } +static void +fido_cred_clean_attobj(fido_cred_t *cred) +{ + free(cred->fmt); + cred->fmt = NULL; + fido_cred_clean_authdata(cred); + fido_cred_clean_attstmt(&cred->attstmt); +} + void fido_cred_reset_tx(fido_cred_t *cred) { @@ -743,7 +752,7 @@ fido_cred_set_attobj(fido_cred_t *cred, const unsigned char *ptr, size_t len) struct cbor_load_result cbor; int r = FIDO_ERR_INVALID_ARGUMENT; - fido_cred_reset_rx(cred); + fido_cred_clean_attobj(cred); if (ptr == NULL || len == 0) goto fail;