diff options
author | 2017-03-15 10:02:57 -0700 | |
---|---|---|
committer | 2017-03-15 10:02:57 -0700 | |
commit | 2ac189e60626b6dbcec48feca8d79614db00baee (patch) | |
tree | 76bfeb452bce845ae5eab70b074267cd7e123c5b /src | |
parent | 3cafec2f55f66e3df61569579c8259b2e5b5ee00 (diff) |
Fix proxy mapper initialization to work with third-party plugins.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/ext/client_channel/proxy_mapper_registry.c | 12 |
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); |