TSI: free the fixture in destruct() instead of in tsi_test_fixture_destroy() (#28312)

pull/28317/head
Mark D. Roth 3 years ago committed by GitHub
parent 8d0fb815a1
commit 19d653d4ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      test/core/tsi/fake_transport_security_test.cc
  2. 1
      test/core/tsi/ssl_transport_security_test.cc
  3. 3
      test/core/tsi/transport_security_test_lib.cc

@ -64,7 +64,7 @@ static void fake_test_check_handshaker_peers(tsi_test_fixture* fixture) {
validate_handshaker_peers(fixture->server_result);
}
static void fake_test_destruct(tsi_test_fixture* /*fixture*/) {}
static void fake_test_destruct(tsi_test_fixture* fixture) { gpr_free(fixture); }
static const struct tsi_test_fixture_vtable vtable = {
fake_test_setup_handshakers, fake_test_check_handshaker_peers,

@ -415,6 +415,7 @@ static void ssl_test_destruct(tsi_test_fixture* fixture) {
ssl_fixture->server_handshaker_factory);
tsi_ssl_client_handshaker_factory_unref(
ssl_fixture->client_handshaker_factory);
gpr_free(ssl_fixture);
}
static const struct tsi_test_fixture_vtable vtable = {

@ -628,10 +628,9 @@ void tsi_test_fixture_destroy(tsi_test_fixture* fixture) {
tsi_test_channel_destroy(fixture->channel);
GPR_ASSERT(fixture->vtable != nullptr);
GPR_ASSERT(fixture->vtable->destruct != nullptr);
fixture->vtable->destruct(fixture);
gpr_mu_destroy(&fixture->mu);
gpr_cv_destroy(&fixture->cv);
gpr_free(fixture);
fixture->vtable->destruct(fixture);
}
tsi_test_frame_protector_fixture* tsi_test_frame_protector_fixture_create() {

Loading…
Cancel
Save