aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/tsi/transport_security_adapter.c
diff options
context:
space:
mode:
authorGravatar jiangtaoli2016 <jiangtao@google.com>2017-04-11 10:16:19 -0700
committerGravatar jiangtaoli2016 <jiangtao@google.com>2017-04-11 11:27:33 -0700
commitc953b62d396d6168507520d837550f6b12d7e729 (patch)
tree1fd9dbdcee8343cf708bac6508b6eba197124b7f /src/core/tsi/transport_security_adapter.c
parent70928f0722b20343dc86ca2d8c76683f78e69e4b (diff)
Transfer ownership of tsi_handshaker in adapter_create_result.
Diffstat (limited to 'src/core/tsi/transport_security_adapter.c')
-rw-r--r--src/core/tsi/transport_security_adapter.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/tsi/transport_security_adapter.c b/src/core/tsi/transport_security_adapter.c
index d83339b3eb..9f2147b530 100644
--- a/src/core/tsi/transport_security_adapter.c
+++ b/src/core/tsi/transport_security_adapter.c
@@ -75,6 +75,7 @@ static tsi_result adapter_result_get_unused_bytes(
static void adapter_result_destroy(tsi_handshaker_result *self) {
tsi_adapter_handshaker_result *impl = (tsi_adapter_handshaker_result *)self;
+ tsi_handshaker_destroy(impl->wrapped);
gpr_free(impl->unused_bytes);
gpr_free(self);
}
@@ -84,7 +85,8 @@ static const tsi_handshaker_result_vtable result_vtable = {
adapter_result_get_unused_bytes, adapter_result_destroy,
};
-tsi_result tsi_adapter_create_handshaker_result(
+/* Ownership of wrapped tsi_handshaker is transferred to the result object. */
+static tsi_result tsi_adapter_create_handshaker_result(
tsi_handshaker *wrapped, const unsigned char *unused_bytes,
size_t unused_bytes_size, tsi_handshaker_result **handshaker_result) {
if (wrapped == NULL || (unused_bytes_size > 0 && unused_bytes == NULL)) {
@@ -201,6 +203,7 @@ static tsi_result adapter_next(
impl->wrapped, unused_bytes, unused_bytes_size, handshaker_result);
if (status == TSI_OK) {
impl->base.handshaker_result_created = true;
+ impl->wrapped = NULL;
}
}
return status;