Don't unref null client_stats.

pull/13985/head
Mark D. Roth 7 years ago
parent 473267b7e8
commit 83d5cd602a
  1. 4
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc

@ -340,8 +340,10 @@ static void pending_pick_set_metadata_and_context(pending_pick* pp) {
pp->pick->subchannel_call_context[GRPC_GRPCLB_CLIENT_STATS].destroy = pp->pick->subchannel_call_context[GRPC_GRPCLB_CLIENT_STATS].destroy =
destroy_client_stats; destroy_client_stats;
} else { } else {
if (pp->client_stats != nullptr) {
grpc_grpclb_client_stats_unref(pp->client_stats); grpc_grpclb_client_stats_unref(pp->client_stats);
} }
}
} }
/* The \a on_complete closure passed as part of the pick requires keeping a /* The \a on_complete closure passed as part of the pick requires keeping a
@ -927,7 +929,9 @@ static void glb_shutdown_locked(grpc_lb_policy* pol,
pending_pick* next = pp->next; pending_pick* next = pp->next;
if (new_policy != nullptr) { if (new_policy != nullptr) {
// Hand pick over to new policy. // Hand pick over to new policy.
if (pp->client_stats != nullptr) {
grpc_grpclb_client_stats_unref(pp->client_stats); grpc_grpclb_client_stats_unref(pp->client_stats);
}
pp->pick->on_complete = pp->original_on_complete; pp->pick->on_complete = pp->original_on_complete;
if (grpc_lb_policy_pick_locked(new_policy, pp->pick)) { if (grpc_lb_policy_pick_locked(new_policy, pp->pick)) {
// Synchronous return; schedule callback. // Synchronous return; schedule callback.

Loading…
Cancel
Save