Skip to content

Commit

Permalink
Added fido_cred_clean_attobj to clean attestation object
Browse files Browse the repository at this point in the history
  • Loading branch information
viveks committed Feb 8, 2024
1 parent d8786be commit 11e2a9c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/cred.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 11e2a9c

Please sign in to comment.