Commit 47d55666 authored by Nils Larsch's avatar Nils Larsch
Browse files

fix error found by coverity: check if ctx is != NULL before calling BN_CTX_end()

parent 90bdfd97
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -217,8 +217,11 @@ static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)

	ret=BN_bn2bin(tmp,key);
err:
	if (ctx != NULL)
		{
		BN_CTX_end(ctx);
		BN_CTX_free(ctx);
		}
	return(ret);
	}

+2 −1
Original line number Diff line number Diff line
@@ -281,6 +281,7 @@ int ec_GF2m_simple_group_check_discriminant(const EC_GROUP *group, BN_CTX *ctx)
	ret = 1;

err:
	if (ctx != NULL)
		BN_CTX_end(ctx);
	if (new_ctx != NULL)
		BN_CTX_free(new_ctx);
+2 −1
Original line number Diff line number Diff line
@@ -113,6 +113,7 @@ int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx)
	ret = 1;

err:
	if (ctx != NULL)
		BN_CTX_end(ctx);
	if (new_ctx != NULL)
		BN_CTX_free(new_ctx);
+2 −1
Original line number Diff line number Diff line
@@ -336,6 +336,7 @@ int ec_GFp_simple_group_check_discriminant(const EC_GROUP *group, BN_CTX *ctx)
	ret = 1;

err:
	if (ctx != NULL)
		BN_CTX_end(ctx);
	if (new_ctx != NULL)
		BN_CTX_free(new_ctx);
+5 −2
Original line number Diff line number Diff line
@@ -183,8 +183,11 @@ err:
		RSAerr(RSA_F_RSA_BUILTIN_KEYGEN,ERR_LIB_BN);
		ok=0;
		}
	if (ctx != NULL)
		{
		BN_CTX_end(ctx);
		BN_CTX_free(ctx);
		}

	return ok;
	}