aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2017-03-17 10:47:30 -0700
committerGravatar GitHub <noreply@github.com>2017-03-17 10:47:30 -0700
commit11c57e89e5b6f869dab744aeb2b0a7dc5be4ca5e (patch)
treea5a0a4604f1a0d4c0724c8dd4d4e5e26a4570181
parenta340987ec4190d8e73d054c0dc44136ea5cb5e4c (diff)
parentd2304d97022b428a115121ffd775ea8002bc27d5 (diff)
Merge pull request #10165 from markdroth/proxy_mapper_init_fix
Fix proxy mapper initialization to work with third-party plugins.
-rw-r--r--src/core/ext/client_channel/proxy_mapper_registry.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/core/ext/client_channel/proxy_mapper_registry.c b/src/core/ext/client_channel/proxy_mapper_registry.c
index 2c44b9d490..0935ddbdbd 100644
--- a/src/core/ext/client_channel/proxy_mapper_registry.c
+++ b/src/core/ext/client_channel/proxy_mapper_registry.c
@@ -94,6 +94,14 @@ static void grpc_proxy_mapper_list_destroy(grpc_proxy_mapper_list* list) {
grpc_proxy_mapper_destroy(list->list[i]);
}
gpr_free(list->list);
+ // Clean up in case we re-initialze later.
+ // TODO(ctiller): This should ideally live in
+ // grpc_proxy_mapper_registry_init(). However, if we did this there,
+ // then we would do it AFTER we start registering proxy mappers from
+ // third-party plugins, so they'd never show up (and would leak memory).
+ // We probably need some sort of dependency system for plugins to fix
+ // this.
+ memset(list, 0, sizeof(*list));
}
//
@@ -102,9 +110,7 @@ static void grpc_proxy_mapper_list_destroy(grpc_proxy_mapper_list* list) {
static grpc_proxy_mapper_list g_proxy_mapper_list;
-void grpc_proxy_mapper_registry_init() {
- memset(&g_proxy_mapper_list, 0, sizeof(g_proxy_mapper_list));
-}
+void grpc_proxy_mapper_registry_init() {}
void grpc_proxy_mapper_registry_shutdown() {
grpc_proxy_mapper_list_destroy(&g_proxy_mapper_list);