From d488ff783f7646b45834d105ac2fcda53783d04c Mon Sep 17 00:00:00 2001 From: samuel40791765 Date: Mon, 8 Jul 2024 20:35:48 +0000 Subject: [PATCH] Set ret to NULL before return --- crypto/ec_extra/ec_asn1.c | 1 + crypto/fipsmodule/ec/ec_test.cc | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/crypto/ec_extra/ec_asn1.c b/crypto/ec_extra/ec_asn1.c index c15cae2831..f2da267409 100644 --- a/crypto/ec_extra/ec_asn1.c +++ b/crypto/ec_extra/ec_asn1.c @@ -656,6 +656,7 @@ EC_POINT *EC_POINT_bn2point(const EC_GROUP *group, const BIGNUM *bn, // If the user did not provide a |point|, we free the |EC_POINT| we // allocated. EC_POINT_free(ret); + ret = NULL; } } diff --git a/crypto/fipsmodule/ec/ec_test.cc b/crypto/fipsmodule/ec/ec_test.cc index 6027188d94..6b8d0a82db 100644 --- a/crypto/fipsmodule/ec/ec_test.cc +++ b/crypto/fipsmodule/ec/ec_test.cc @@ -1184,7 +1184,7 @@ TEST(ECTest, BIGNUMConvert) { // Test specific openssl/openssl#10258 case for |BN_zero|. bssl::UniquePtr zero(BN_new()); BN_zero(zero.get()); - EXPECT_TRUE(EC_POINT_bn2point(group.get(), zero.get(), nullptr, nullptr)); + EXPECT_FALSE(EC_POINT_bn2point(group.get(), zero.get(), nullptr, nullptr)); } TEST(ECTest, SetKeyWithoutGroup) {