Fix memory leak

This commit is contained in:
Tesfa Mael
2020-03-12 23:24:44 -07:00
parent 87ff2fa47d
commit 452b4c03a6
2 changed files with 5 additions and 3 deletions

View File

@@ -18298,7 +18298,7 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD *md)
if (enc == 0 || enc == 1)
ctx->enc = enc ? 1 : 0;
if (key) {
ret = wc_AesXtsSetKey(&ctx->cipher.xts, key, ctx->keyLen,
ret = wc_AesXtsSetKey(&ctx->cipher.xts, key, ctx->keyLen,
ctx->enc ? AES_ENCRYPTION : AES_DECRYPTION, NULL, 0);
if (ret != 0) {
WOLFSSL_MSG("wc_AesXtsSetKey() failed");
@@ -18328,7 +18328,7 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD *md)
if (enc == 0 || enc == 1)
ctx->enc = enc ? 1 : 0;
if (key) {
ret = wc_AesXtsSetKey(&ctx->cipher.xts, key, ctx->keyLen,
ret = wc_AesXtsSetKey(&ctx->cipher.xts, key, ctx->keyLen,
ctx->enc ? AES_ENCRYPTION : AES_DECRYPTION, NULL, 0);
if (ret != 0) {
WOLFSSL_MSG("wc_AesXtsSetKey() failed");
@@ -36137,6 +36137,7 @@ int wolfSSL_EC_POINT_get_affine_coordinates_GFp(const WOLFSSL_EC_GROUP *group,
BN_copy(x, point->X);
BN_copy(y, point->Y);
mp_clear(&modulus);
return WOLFSSL_SUCCESS;
}
@@ -48640,8 +48641,10 @@ int wolfSSL_BN_clear_bit(WOLFSSL_BIGNUM* bn, int n)
goto cleanup;
}
}
ret = WOLFSSL_SUCCESS;
cleanup:
mp_clear(tmp);
#ifdef WOLFSSL_SMALL_STACK
if (tmp)
XFREE(tmp, NULL, DYNAMIC_TYPE_BIGINT);

View File

@@ -1839,7 +1839,6 @@ static void test_wolfSSL_EC(void)
/* Force non-affine coordinates */
AssertIntEQ(wolfSSL_BN_add(new_point->Z, (WOLFSSL_BIGNUM*)BN_value_one(),
(WOLFSSL_BIGNUM*)BN_value_one()), 1);
new_point->inSet = 0;
/* extract the coordinates from point */
AssertIntEQ(EC_POINT_get_affine_coordinates_GFp(group, new_point, X, Y, ctx), WOLFSSL_SUCCESS);