Skip to content

Commit 60c1558

Browse files
authored
Merge pull request #8447 from dgarske/memleak
Fixed possible memory leaks
2 parents e806bd7 + f943f6f commit 60c1558

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/crl.c

+4
Original file line numberDiff line numberDiff line change
@@ -1776,6 +1776,10 @@ int LoadCRL(WOLFSSL_CRL* crl, const char* path, int type, int monitor)
17761776
ret = ProcessFile(NULL, name, type, CRL_TYPE, NULL, 0, crl, VERIFY);
17771777
if (ret != WOLFSSL_SUCCESS) {
17781778
WOLFSSL_MSG("CRL file load failed");
1779+
wc_ReadDirClose(readCtx);
1780+
#ifdef WOLFSSL_SMALL_STACK
1781+
XFREE(readCtx, crl->heap, DYNAMIC_TYPE_TMP_BUFFER);
1782+
#endif
17791783
return ret;
17801784
}
17811785
}

wolfcrypt/src/evp.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -4035,9 +4035,13 @@ int wolfSSL_EVP_SignFinal(WOLFSSL_EVP_MD_CTX *ctx, unsigned char *sigret,
40354035
pkey->ecc);
40364036
if (ecdsaSig == NULL)
40374037
return WOLFSSL_FAILURE;
4038+
/* get signature length only */
40384039
ret = wolfSSL_i2d_ECDSA_SIG(ecdsaSig, NULL);
4039-
if (ret <= 0 || ret > (int)*siglen)
4040+
if (ret <= 0 || ret > (int)*siglen) {
4041+
wolfSSL_ECDSA_SIG_free(ecdsaSig);
40404042
return WOLFSSL_FAILURE;
4043+
}
4044+
/* perform validation of signature */
40414045
ret = wolfSSL_i2d_ECDSA_SIG(ecdsaSig, &sigret);
40424046
wolfSSL_ECDSA_SIG_free(ecdsaSig);
40434047
if (ret <= 0 || ret > (int)*siglen)

0 commit comments

Comments
 (0)