forked from wolfSSL/wolfssl
Fixed possible memory leaks reported by nielsdos in PR 8415 and 8414.
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user