Fix httpcli cleanup code.

pull/8913/head
Mark D. Roth 8 years ago
parent 412e6acaaa
commit 9b3f1b7ab1
  1. 12
      src/core/lib/http/httpcli_security_connector.c

@ -158,18 +158,24 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg,
grpc_error *error) {
grpc_handshaker_args *args = arg;
on_done_closure *c = args->user_data;
grpc_channel_args_destroy(args->args);
grpc_slice_buffer_destroy(args->read_buffer);
gpr_free(args->read_buffer);
if (error != GRPC_ERROR_NONE) {
const char* msg = grpc_error_string(error);
gpr_log(GPR_ERROR, "Secure transport setup failed: %s", msg);
grpc_error_free_string(msg);
c->func(exec_ctx, c->arg, NULL);
// TODO(ctiller): It is currently necessary to shutdown endpoints
// before destroying them, even if we know that there are no
// pending read/write callbacks. This should be fixed, at which
// point this can be removed.
grpc_endpoint_shutdown(exec_ctx, args->endpoint);
grpc_endpoint_destroy(exec_ctx, args->endpoint);
} else {
c->func(exec_ctx, c->arg, args->endpoint);
}
gpr_free(c);
grpc_channel_args_destroy(args->args);
gpr_free(args->read_buffer);
gpr_free(args);
}
static void ssl_handshake(grpc_exec_ctx *exec_ctx, void *arg,

Loading…
Cancel
Save