diff --git a/test/unittest/src/crypto_ed25519_asy_key_generator_test.cpp b/test/unittest/src/crypto_ed25519_asy_key_generator_test.cpp index 9925e6c75fd60e2d97bf4393973914f52bbbc405..eefbcf871b3b55175cd57b7e7c87d8b71cfef653 100644 --- a/test/unittest/src/crypto_ed25519_asy_key_generator_test.cpp +++ b/test/unittest/src/crypto_ed25519_asy_key_generator_test.cpp @@ -376,9 +376,11 @@ HWTEST_F(CryptoEd25519AsyKeyGeneratorTest, CryptoEd25519AsyKeyGeneratorTest015, HcfResult res = TestGenerateKeyPairAndConvertKey(g_ed25519AlgoName.c_str(), &generator, &g_mockEd25519PubKeyBlob, &g_mockEd25519PriKeyBlob, &keyPair); ASSERT_EQ(res, HCF_SUCCESS); + HcfObjDestroy(keyPair); res = TestGenerateConvertKey(generator, nullptr, &g_mockEd25519PriKeyBlob, &keyPair); ASSERT_EQ(res, HCF_SUCCESS); + HcfObjDestroy(keyPair); res = TestGenerateConvertKey(generator, &g_mockEd25519PubKeyBlob, nullptr, &keyPair); ASSERT_EQ(res, HCF_SUCCESS); diff --git a/test/unittest/src/ecc/crypto_ecc_no_length_sign_sub_test.cpp b/test/unittest/src/ecc/crypto_ecc_no_length_sign_sub_test.cpp index 16335c22288d92af4be867f3668fa0faaaf47b16..d91e34e584c3b0d2c022133bb0061680bd522432 100644 --- a/test/unittest/src/ecc/crypto_ecc_no_length_sign_sub_test.cpp +++ b/test/unittest/src/ecc/crypto_ecc_no_length_sign_sub_test.cpp @@ -1185,6 +1185,7 @@ HWTEST_F(CryptoEccNoLengthSignSubTest, CryptoEccNoLengthSignSubTest927, TestSize HcfFree(out.data); HcfObjDestroy(sign); + HcfObjDestroy(keyPair); } HWTEST_F(CryptoEccNoLengthSignSubTest, CryptoEccNoLengthSignSubTest928, TestSize.Level0) @@ -1226,6 +1227,7 @@ HWTEST_F(CryptoEccNoLengthSignSubTest, CryptoEccNoLengthSignSubTest928, TestSize HcfFree(out.data); HcfObjDestroy(sign); + HcfObjDestroy(keyPair); } HcfSignatureParams g_params = { @@ -1455,7 +1457,7 @@ HWTEST_F(CryptoEccNoLengthSignSubTest, CryptoEccNoLengthSignSubTest1101, TestSiz HcfFree(out.data); HcfObjDestroy(sign); - + HcfObjDestroy(keyPair); uint32_t mallocCount = GetMallocNum(); MemoryMallocTestFunc(mallocCount, &input); @@ -1549,7 +1551,7 @@ HWTEST_F(CryptoEccNoLengthSignSubTest, CryptoEccNoLengthSignSubTest1102, TestSiz HcfFree(out.data); HcfObjDestroy(sign); - + HcfObjDestroy(keyPair); uint32_t mallocCount = GetOpensslCallNum(); OpensslMockTestFunc(mallocCount, &input); diff --git a/test/unittest/src/ecc/crypto_ecc_no_length_verify_sub_test.cpp b/test/unittest/src/ecc/crypto_ecc_no_length_verify_sub_test.cpp index cc7455550a351c98eaaff6b76a1a8e0f604def43..3bc18ca802ccb86211fc5b88788461bbd5920190 100644 --- a/test/unittest/src/ecc/crypto_ecc_no_length_verify_sub_test.cpp +++ b/test/unittest/src/ecc/crypto_ecc_no_length_verify_sub_test.cpp @@ -2080,6 +2080,7 @@ HWTEST_F(CryptoEccNoLengthVerifySubTest, CryptoEccNoLengthVerifySubTest601, Test uint32_t mallocCount = GetMallocNum(); MemoryMockTestFunc(mallocCount, &out); + HcfFree(out.data); EndRecordMallocNum(); } @@ -2135,6 +2136,7 @@ HWTEST_F(CryptoEccNoLengthVerifySubTest, CryptoEccNoLengthVerifySubTest602, Test uint32_t mallocCount = GetOpensslCallNum(); OpensslMockTestFunc(mallocCount, &out); + HcfFree(out.data); EndRecordOpensslCallNum(); } }