diff --git a/googletest/test/googletest-port-test.cc b/googletest/test/googletest-port-test.cc index e0793bad..8d210260 100644 --- a/googletest/test/googletest-port-test.cc +++ b/googletest/test/googletest-port-test.cc @@ -296,7 +296,7 @@ void* ThreadFunc(void* data) { TEST(GetThreadCountTest, ReturnsCorrectValue) { size_t starting_count; size_t thread_count_after_create; - size_t thread_count_after_join; + size_t thread_count_after_join = 0; // We can't guarantee that no other thread was created or destroyed between // any two calls to GetThreadCount(). We make multiple attempts, hoping that @@ -316,9 +316,9 @@ TEST(GetThreadCountTest, ReturnsCorrectValue) { const int status = pthread_create(&thread_id, &attr, &ThreadFunc, &mutex); ASSERT_EQ(0, pthread_attr_destroy(&attr)); ASSERT_EQ(0, status); - } - thread_count_after_create = GetThreadCount(); + thread_count_after_create = GetThreadCount(); + } void* dummy; ASSERT_EQ(0, pthread_join(thread_id, &dummy));