diff options
author | Craig Tiller <ctiller@google.com> | 2015-07-19 10:52:04 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2015-07-19 10:52:04 -0700 |
commit | 5246838657be5020eaaeccc5ae9c18b04db6077d (patch) | |
tree | ddd97cdeb95a30c98b48c5a2d3701f5e7cbb8afc /src/core/channel | |
parent | 03dc655d2e856d5809135dd021cf17fa7ace5021 (diff) |
Fix a use after free
Diffstat (limited to 'src/core/channel')
-rw-r--r-- | src/core/channel/client_channel.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/core/channel/client_channel.c b/src/core/channel/client_channel.c index d52fe9b996..2d1962cbc4 100644 --- a/src/core/channel/client_channel.c +++ b/src/core/channel/client_channel.c @@ -409,21 +409,18 @@ static void watch_lb_policy(channel_data *chand, grpc_lb_policy *lb_policy, grpc static void on_lb_policy_state_changed(void *arg, int iomgr_success) { lb_policy_connectivity_watcher *w = arg; - int start_new = 0; gpr_mu_lock(&w->chand->mu_config); /* check if the notification is for a stale policy */ if (w->lb_policy == w->chand->lb_policy) { grpc_connectivity_state_set(&w->chand->state_tracker, w->state, "lb_changed"); - start_new = (w->state != GRPC_CHANNEL_FATAL_FAILURE); + if (w->state != GRPC_CHANNEL_FATAL_FAILURE) { + watch_lb_policy(w->chand, w->lb_policy, w->state); + } } gpr_mu_unlock(&w->chand->mu_config); - if (start_new) { - watch_lb_policy(w->chand, w->lb_policy, w->state); - } - GRPC_CHANNEL_INTERNAL_UNREF(w->chand->master, "watch_lb_policy"); gpr_free(w); } |