diff options
author | Yuchen Zeng <zyc@google.com> | 2017-03-17 13:29:26 -0700 |
---|---|---|
committer | Yuchen Zeng <zyc@google.com> | 2017-03-17 16:00:20 -0700 |
commit | 4a769943ddbe3264089c4f051e48ed45b9c2087f (patch) | |
tree | f335e3a28734e0519ddfaed61d8763b155bd6277 /src/core/ext/resolver | |
parent | 9bc0d8200ec17ababe4c9cd6134a2cb7465365a6 (diff) |
Use zalloc in c-ares resolver
Diffstat (limited to 'src/core/ext/resolver')
-rw-r--r-- | src/core/ext/resolver/dns/c_ares/dns_resolver_ares.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/core/ext/resolver/dns/c_ares/dns_resolver_ares.c b/src/core/ext/resolver/dns/c_ares/dns_resolver_ares.c index db26d12fdd..b7cdc63d75 100644 --- a/src/core/ext/resolver/dns/c_ares/dns_resolver_ares.c +++ b/src/core/ext/resolver/dns/c_ares/dns_resolver_ares.c @@ -248,7 +248,7 @@ static void dns_ares_next(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver, grpc_closure *on_complete) { ares_dns_resolver *r = (ares_dns_resolver *)resolver; dns_ares_next_locked_args *args = - gpr_malloc(sizeof(dns_ares_next_locked_args)); + gpr_zalloc(sizeof(dns_ares_next_locked_args)); args->target_result = target_result; args->on_complete = on_complete; args->resolver = resolver; @@ -308,8 +308,7 @@ static grpc_resolver *dns_ares_create(grpc_exec_ctx *exec_ctx, } if (path[0] == '/') ++path; // Create resolver. - ares_dns_resolver *r = gpr_malloc(sizeof(ares_dns_resolver)); - memset(r, 0, sizeof(*r)); + ares_dns_resolver *r = gpr_zalloc(sizeof(ares_dns_resolver)); r->combiner = grpc_combiner_create(NULL); grpc_resolver_init(&r->base, &dns_ares_resolver_vtable, r->combiner); r->name_to_resolve = gpr_strdup(path); |