Skip to content

Commit

Permalink
Fix memory leak in PKCS aws#11 test.
Browse files Browse the repository at this point in the history
lundinc2 committed Dec 17, 2020

Verified

This commit was signed with the committer’s verified signature.
MartinThoma Martin Thoma
1 parent 5d7677e commit 183068d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion integration-test/pkcs11/system-tests/pkcs11_system_test.c
Original file line number Diff line number Diff line change
@@ -994,10 +994,12 @@ void test_Sign_EC( void )
mbedtls_pk_context * ecdsaContextPtr = &ecdsaContext;
CK_ATTRIBUTE pubKeyQuery = { CKA_EC_POINT, NULL, 0 };
CK_BYTE * publicKeyPtr = NULL;

mbedtls_pk_init( ecdsaContextPtr );

/* Reconstruct public key from EC Params. */
mbedtls_ecp_keypair * keyPair;

keyPair = PKCS11_MALLOC( sizeof( mbedtls_ecp_keypair ) );
TEST_ASSERT_NOT_EQUAL_MESSAGE( NULL, keyPair, "Failed to allocate memory for the mbed TLS context." );

@@ -1057,6 +1059,7 @@ void test_Sign_EC( void )
mbedtls_mpi_free( &S );
}

PKCS11_FREE( publicKeyPtr );
mbedtls_pk_free( &ecdsaContext );
}

@@ -1280,7 +1283,6 @@ void test_GetAttributeValue_EC( void )
result = globalFunctionList->C_GetAttributeValue( globalSession, publicKey, &template, 1 );
TEST_ASSERT_EQUAL_MESSAGE( CKR_OK, result, "GetAttributeValue for EC point failed." );
#if pkcs11testIMPORT_PRIVATE_KEY_SUPPORT == 1

/* The EC point can only be known for a public key that was previously created
* therefore this check is only done for implementations that support importing
* a private key, as the credentials that are on the device are all known.

0 comments on commit 183068d

Please sign in to comment.