From 30bce6ab1bbddbad4bbc2d2d2c8056b979a3cf2a Mon Sep 17 00:00:00 2001
From: David Garcia Quintas <dgq@google.com>
Date: Thu, 20 Oct 2016 20:12:51 -0700
Subject: [PATCH] Moved unref of security connector outside of
 grpc_secure_channel_create

---
 .../transport/chttp2/client/secure/secure_channel_create.c   | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c
index 31c54ff74c..cba7ec472a 100644
--- a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c
+++ b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c
@@ -290,8 +290,6 @@ static grpc_channel *client_channel_factory_create_channel(
     channel = NULL;
   }
 
-  GRPC_SECURITY_CONNECTOR_UNREF(&f->security_connector->base,
-                                "client_channel_factory_create_channel");
   return channel;
 }
 
@@ -360,6 +358,9 @@ grpc_channel *grpc_secure_channel_create(grpc_channel_credentials *creds,
   grpc_channel *channel = client_channel_factory_create_channel(
       &exec_ctx, &f->base, target, GRPC_CLIENT_CHANNEL_TYPE_REGULAR, NULL);
 
+  GRPC_SECURITY_CONNECTOR_UNREF(&f->security_connector->base,
+                                "client_channel_factory_create_channel");
+
   grpc_client_channel_factory_unref(&exec_ctx, &f->base);
   grpc_exec_ctx_finish(&exec_ctx);
 
-- 
GitLab