From 38ba4661cec913c72b81beb15f34e263c694858b Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Fri, 23 Jun 2017 18:24:01 -0700 Subject: Fix segfault in rr trace --- .../ext/filters/client_channel/lb_policy/round_robin/round_robin.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c index 3c8520cc1c..e7d38f751d 100644 --- a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +++ b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c @@ -571,11 +571,13 @@ static void rr_connectivity_changed_locked(grpc_exec_ctx *exec_ctx, void *arg, GPR_ASSERT(sd->subchannel_list == p->latest_pending_subchannel_list); GPR_ASSERT(!sd->subchannel_list->shutting_down); if (GRPC_TRACER_ON(grpc_lb_round_robin_trace)) { + const unsigned long num_subchannels = + p->subchannel_list != NULL ? p->subchannel_list->num_subchannels + : 0; gpr_log(GPR_DEBUG, "[RR %p] phasing out subchannel list %p (size %lu) in favor " "of %p (size %lu)", - (void *)p, (void *)p->subchannel_list, - (unsigned long)p->subchannel_list->num_subchannels, + (void *)p, (void *)p->subchannel_list, num_subchannels, (void *)sd->subchannel_list, (unsigned long)sd->subchannel_list->num_subchannels); } -- cgit v1.2.3