aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext/client_config
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2016-08-17 13:51:05 -0700
committerGravatar Mark D. Roth <roth@google.com>2016-08-17 13:51:05 -0700
commit2d7387cede74dc1be16b9336d5388daa30cfbda9 (patch)
treeef911f84a3080b22d0b68e0ba32443b6c304e115 /src/core/ext/client_config
parentfcaeb38e8c58ebe3bf52bb8075b0674e0b5c6a99 (diff)
Fix asan failures.
Diffstat (limited to 'src/core/ext/client_config')
-rw-r--r--src/core/ext/client_config/subchannel.h2
-rw-r--r--src/core/ext/client_config/subchannel_index.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/core/ext/client_config/subchannel.h b/src/core/ext/client_config/subchannel.h
index 40d90be124..a24dbe80fb 100644
--- a/src/core/ext/client_config/subchannel.h
+++ b/src/core/ext/client_config/subchannel.h
@@ -163,7 +163,7 @@ struct grpc_subchannel_args {
/** Channel arguments to be supplied to the newly created channel */
const grpc_channel_args *args;
/** Server name */
- char *server_name; // Does not own.
+ char *server_name;
/** Address to connect to */
struct sockaddr *addr;
size_t addr_len;
diff --git a/src/core/ext/client_config/subchannel_index.c b/src/core/ext/client_config/subchannel_index.c
index 891c066f2c..40ce91492d 100644
--- a/src/core/ext/client_config/subchannel_index.c
+++ b/src/core/ext/client_config/subchannel_index.c
@@ -38,6 +38,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/avl.h>
+#include <grpc/support/string_util.h>
#include <grpc/support/tls.h>
#include "src/core/lib/channel/channel_args.h"
@@ -85,7 +86,7 @@ static grpc_subchannel_key *create_key(
} else {
k->args.filters = NULL;
}
- k->args.server_name = args->server_name;
+ k->args.server_name = gpr_strdup(args->server_name);
k->args.addr_len = args->addr_len;
k->args.addr = gpr_malloc(args->addr_len);
if (k->args.addr_len > 0) {
@@ -131,6 +132,7 @@ void grpc_subchannel_key_destroy(grpc_exec_ctx *exec_ctx,
grpc_connector_unref(exec_ctx, k->connector);
gpr_free((grpc_channel_args *)k->args.filters);
grpc_channel_args_destroy((grpc_channel_args *)k->args.args);
+ gpr_free(k->args.server_name);
gpr_free(k->args.addr);
gpr_free(k);
}