aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Yang Gao <yangg@google.com>2015-10-05 13:40:33 -0700
committerGravatar Yang Gao <yangg@google.com>2015-10-05 13:40:33 -0700
commit27155937a862c8d3edfef82ec34bac8c4f63ecac (patch)
treedad1fd6fd8d9482fd9acc547f4082d74bdf226bb
parent69d5c190368f432ed67c818c7c8a8fae13b57778 (diff)
parentbae235cd5fdfd10f63308e70eff8e689449e040b (diff)
Merge pull request #3629 from ctiller/sharply-sea
Fix use-after-free
-rw-r--r--src/core/iomgr/pollset_posix.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/core/iomgr/pollset_posix.c b/src/core/iomgr/pollset_posix.c
index 9042827484..b663780a02 100644
--- a/src/core/iomgr/pollset_posix.c
+++ b/src/core/iomgr/pollset_posix.c
@@ -477,6 +477,7 @@ static void basic_pollset_maybe_work_and_unlock(grpc_exec_ctx *exec_ctx,
if (fd) {
pfd[2].fd = fd->fd;
pfd[2].revents = 0;
+ GRPC_FD_REF(fd, "basicpoll_begin");
gpr_mu_unlock(&pollset->mu);
pfd[2].events =
(short)grpc_fd_begin_poll(fd, pollset, POLLIN, POLLOUT, &fd_watcher);
@@ -523,6 +524,10 @@ static void basic_pollset_maybe_work_and_unlock(grpc_exec_ctx *exec_ctx,
}
}
}
+
+ if (fd) {
+ GRPC_FD_UNREF(fd, "basicpoll_begin");
+ }
}
static void basic_pollset_destroy(grpc_pollset *pollset) {