fix more detected mu/cv leaks

pull/17939/head
xtao 6 years ago
parent 902820a5de
commit 7766912dda
No known key found for this signature in database
GPG Key ID: 87F7A86BDA3A0407
  1. 5
      src/core/ext/transport/inproc/inproc_transport.cc
  2. 5
      test/core/end2end/inproc_callback_test.cc
  3. 2
      test/core/gpr/cpu_test.cc
  4. 1
      test/core/gpr/mpscq_test.cc
  5. 2
      test/core/gprpp/thd_test.cc
  6. 2
      test/cpp/microbenchmarks/bm_closure.cc
  7. 1
      test/cpp/util/grpc_tool.cc

@ -64,9 +64,7 @@ struct shared_mu {
gpr_ref_init(&refs, 2);
}
~shared_mu() {
gpr_mu_destroy(&mu);
}
~shared_mu() { gpr_mu_destroy(&mu); }
gpr_mu mu;
gpr_refcount refs;
@ -87,6 +85,7 @@ struct inproc_transport {
~inproc_transport() {
grpc_connectivity_state_destroy(&connectivity);
if (gpr_unref(&mu->refs)) {
mu->~shared_mu();
gpr_free(mu);
}
}

@ -65,7 +65,10 @@ class ShutdownCallback : public grpc_experimental_completion_queue_functor {
gpr_mu_init(&mu_);
gpr_cv_init(&cv_);
}
~ShutdownCallback() {}
~ShutdownCallback() {
gpr_mu_destroy(&mu_);
gpr_cv_destroy(&cv_);
}
static void StaticRun(grpc_experimental_completion_queue_functor* cb,
int ok) {
auto* callback = static_cast<ShutdownCallback*>(cb);

@ -140,6 +140,8 @@ static void cpu_test(void) {
}
fprintf(stderr, "] (%d/%d)\n", cores_seen, ct.ncores);
fflush(stderr);
gpr_mu_destroy(&ct.mu);
gpr_cv_destroy(&ct.done_cv);
gpr_free(ct.used);
}

@ -178,6 +178,7 @@ static void test_mt_multipop(void) {
for (auto& th : thds) {
th.Join();
}
gpr_mu_destroy(&pa.mu);
gpr_mpscq_destroy(&q);
}

@ -71,6 +71,8 @@ static void test1(void) {
th.Join();
}
GPR_ASSERT(t.n == 0);
gpr_mu_destroy(&t.mu);
gpr_cv_destroy(&t.done_cv);
}
static void thd_body2(void* v) {}

@ -183,6 +183,7 @@ static void BM_AcquireMutex(benchmark::State& state) {
DoNothing(nullptr, GRPC_ERROR_NONE);
gpr_mu_unlock(&mu);
}
gpr_mu_destroy(&mu);
track_counters.Finish(state);
}
@ -202,6 +203,7 @@ static void BM_TryAcquireMutex(benchmark::State& state) {
abort();
}
}
gpr_mu_destroy(&mu);
track_counters.Finish(state);
}

@ -590,6 +590,7 @@ bool GrpcTool::CallMethod(int argc, const char** argv,
call.WritesDoneAndWait();
read_thread.join();
gpr_mu_destroy(&parser_mu);
std::multimap<grpc::string_ref, grpc::string_ref> server_trailing_metadata;
Status status = call.Finish(&server_trailing_metadata);

Loading…
Cancel
Save