Skip to content

Commit

Permalink
Use zalloc in c-ares resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
y-zeng committed Mar 17, 2017
1 parent 9bc0d82 commit 4a76994
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/core/ext/resolver/dns/c_ares/dns_resolver_ares.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 4a76994

Please sign in to comment.