Skip to content

Commit

Permalink
Merge pull request #8447 from dgarske/memleak
Browse files Browse the repository at this point in the history
Fixed possible memory leaks
  • Loading branch information
douzzer authored Feb 14, 2025
2 parents e806bd7 + f943f6f commit 60c1558
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/crl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1776,6 +1776,10 @@ int LoadCRL(WOLFSSL_CRL* crl, const char* path, int type, int monitor)
ret = ProcessFile(NULL, name, type, CRL_TYPE, NULL, 0, crl, VERIFY);
if (ret != WOLFSSL_SUCCESS) {
WOLFSSL_MSG("CRL file load failed");
wc_ReadDirClose(readCtx);
#ifdef WOLFSSL_SMALL_STACK
XFREE(readCtx, crl->heap, DYNAMIC_TYPE_TMP_BUFFER);
#endif
return ret;
}
}
Expand Down
6 changes: 5 additions & 1 deletion wolfcrypt/src/evp.c
Original file line number Diff line number Diff line change
Expand Up @@ -4035,9 +4035,13 @@ int wolfSSL_EVP_SignFinal(WOLFSSL_EVP_MD_CTX *ctx, unsigned char *sigret,
pkey->ecc);
if (ecdsaSig == NULL)
return WOLFSSL_FAILURE;
/* get signature length only */
ret = wolfSSL_i2d_ECDSA_SIG(ecdsaSig, NULL);
if (ret <= 0 || ret > (int)*siglen)
if (ret <= 0 || ret > (int)*siglen) {
wolfSSL_ECDSA_SIG_free(ecdsaSig);
return WOLFSSL_FAILURE;
}
/* perform validation of signature */
ret = wolfSSL_i2d_ECDSA_SIG(ecdsaSig, &sigret);
wolfSSL_ECDSA_SIG_free(ecdsaSig);
if (ret <= 0 || ret > (int)*siglen)
Expand Down

0 comments on commit 60c1558

Please sign in to comment.