aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-08-06 17:49:49 -0700
committerGravatar Craig Tiller <ctiller@google.com>2015-08-06 17:49:49 -0700
commitb933c2cd55883880b4babc6055f9bbdaa9267476 (patch)
tree37dda7c6bb1d9e54e47ad3ff170174ea73d9d2c3 /test
parent9a0c10efc6b936acdbafde338cf3ed8ccfb2f689 (diff)
Fix memory leaks
Diffstat (limited to 'test')
-rw-r--r--test/core/util/port_posix.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/core/util/port_posix.c b/test/core/util/port_posix.c
index 62d5e7df20..9bff18d311 100644
--- a/test/core/util/port_posix.c
+++ b/test/core/util/port_posix.c
@@ -153,6 +153,11 @@ static void got_port_from_server(void *arg,
gpr_mu_unlock(GRPC_POLLSET_MU(&pr->pollset));
}
+static void destroy_pollset_and_shutdown(void *p) {
+ grpc_pollset_destroy(p);
+ grpc_shutdown();
+}
+
static int pick_port_using_server(char *server) {
grpc_httpcli_context context;
grpc_httpcli_request req;
@@ -180,7 +185,8 @@ static int pick_port_using_server(char *server) {
}
gpr_mu_unlock(GRPC_POLLSET_MU(&pr.pollset));
- grpc_shutdown();
+ grpc_httpcli_context_destroy(&context);
+ grpc_pollset_shutdown(&pr.pollset, destroy_pollset_and_shutdown, &pr.pollset);
return pr.port;
}