Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/jws.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ static bool _cjose_jws_build_dig_sha(cjose_jws_t *jws, const cjose_jwk_t *jwk, c

if (NULL != jws->dig)
{
cjose_get_dealloc()(jws->dig);
jws->dig = NULL;
cjose_get_dealloc()(jws->dig);
jws->dig = NULL;
}

// allocate buffer for digest
Expand Down Expand Up @@ -264,6 +264,12 @@ static bool _cjose_jws_build_dig_hmac_sha(cjose_jws_t *jws, const cjose_jwk_t *j
goto _cjose_jws_build_dig_hmac_sha_cleanup;
}

if (NULL != jws->dig)
{
cjose_get_dealloc()(jws->dig);
jws->dig = NULL;
}

// allocate buffer for digest
jws->dig_len = EVP_MD_size(digest_alg);
jws->dig = (uint8_t *)cjose_get_alloc()(jws->dig_len);
Expand Down