aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2015-11-19 21:55:44 +0100
committerGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2015-11-19 21:55:44 +0100
commitc6a7c6e02cdf52c0ff99f4451923e3858db74ed4 (patch)
tree41e902222d11afe1475d55195307a07baef94705
parent8f714620b21d6c25b9d67d6d36b1e216dc8cbe94 (diff)
Fixing use after free under Posix (was already fixed for Windows.)
-rw-r--r--src/core/iomgr/tcp_server_posix.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/iomgr/tcp_server_posix.c b/src/core/iomgr/tcp_server_posix.c
index fbc0e974e6..5daf406c99 100644
--- a/src/core/iomgr/tcp_server_posix.c
+++ b/src/core/iomgr/tcp_server_posix.c
@@ -144,13 +144,13 @@ grpc_tcp_server *grpc_tcp_server_create(void) {
}
static void finish_shutdown(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) {
- grpc_tcp_listener *sp;
-
grpc_exec_ctx_enqueue(exec_ctx, s->shutdown_complete, 1);
gpr_mu_destroy(&s->mu);
- for (sp = s->head; sp; sp = sp->next) {
+ while (s->head) {
+ grpc_tcp_listener *sp = s->head;
+ s->head = sp->next;
grpc_tcp_listener_unref(sp);
}