Merge pull request #8822 from dgquintas/grpclb_serverlist_leak

Fixed leak upon duped serverlist updates
pull/7655/head
David G. Quintas 8 years ago committed by GitHub
commit 7cb13183d4
  1. 5
      src/core/ext/lb_policy/grpclb/grpclb.c

@ -1238,12 +1238,15 @@ static void lb_on_response_received(grpc_exec_ctx *exec_ctx, void *arg,
gpr_log(GPR_INFO, gpr_log(GPR_INFO,
"Incoming server list identical to current, ignoring."); "Incoming server list identical to current, ignoring.");
} }
grpc_grpclb_destroy_serverlist(serverlist);
} else { /* new serverlist */ } else { /* new serverlist */
if (glb_policy->serverlist != NULL) { if (glb_policy->serverlist != NULL) {
/* dispose of the old serverlist */ /* dispose of the old serverlist */
grpc_grpclb_destroy_serverlist(glb_policy->serverlist); grpc_grpclb_destroy_serverlist(glb_policy->serverlist);
} }
/* and update the copy in the glb_lb_policy instance */ /* and update the copy in the glb_lb_policy instance. This serverlist
* instance will be destroyed either upon the next update or in
* glb_destroy() */
glb_policy->serverlist = serverlist; glb_policy->serverlist = serverlist;
rr_handover_locked(exec_ctx, glb_policy); rr_handover_locked(exec_ctx, glb_policy);

Loading…
Cancel
Save