From 4a769943ddbe3264089c4f051e48ed45b9c2087f Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Fri, 17 Mar 2017 13:29:26 -0700 Subject: [PATCH] Use zalloc in c-ares resolver --- src/core/ext/resolver/dns/c_ares/dns_resolver_ares.c | 5 ++--- 1 file 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 db26d12fdd5..b7cdc63d750 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);