From 590d08ba6f787955dd041955abb1f959667821d5 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Wed, 1 Feb 2017 18:25:01 +0000 Subject: [PATCH] Fix asan bug. --- src/core/ext/client_channel/client_channel.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/ext/client_channel/client_channel.c b/src/core/ext/client_channel/client_channel.c index 352336179e6..9952982ff5d 100644 --- a/src/core/ext/client_channel/client_channel.c +++ b/src/core/ext/client_channel/client_channel.c @@ -547,8 +547,10 @@ static grpc_error *cc_init_channel_elem(grpc_exec_ctx *exec_ctx, GPR_ASSERT(arg != NULL); GPR_ASSERT(arg->type == GRPC_ARG_STRING); grpc_uri *uri = grpc_uri_parse(arg->value.string, true); - if (uri == NULL || uri->path[0] == '\0') { - return GRPC_ERROR_CREATE("cannot parse server URI"); + if (uri == NULL) return GRPC_ERROR_CREATE("cannot parse server URI"); + if (uri->path[0] == '\0') { + grpc_uri_destroy(uri); + return GRPC_ERROR_CREATE("server URI is missing path"); } chand->server_name = gpr_strdup(uri->path[0] == '/' ? uri->path + 1 : uri->path);