Fixed gpuservice_unittest mem leaks

  Updated GpuStatsTest to destroy GpuStats instance in advance.
  It enables binder to process pending transactions prior test is
  destroyed, preventing memory leaks.

Bug: 222527290
Test: atest gpuservice_unittest
Change-Id: Icf9dfe895b835f2be2d0f69d74e978277b9e1579
diff --git a/services/gpuservice/tests/unittests/GpuStatsTest.cpp b/services/gpuservice/tests/unittests/GpuStatsTest.cpp
index 3c7644f..7ea2288 100644
--- a/services/gpuservice/tests/unittests/GpuStatsTest.cpp
+++ b/services/gpuservice/tests/unittests/GpuStatsTest.cpp
@@ -76,6 +76,12 @@
                 ::testing::UnitTest::GetInstance()->current_test_info();
         ALOGD("**** Tearing down after %s.%s\n", test_info->test_case_name(), test_info->name());
 
+        // This is required for test due to GpuStats instance spawns binder transactions
+        // in its destructor. After the gtest destructor test exits immidiatelly.
+        // It results in binder thread not able to process above binder transactions and memory leak
+        // occures. Binder thread needs time to process callbacks transactions.
+        // It leads to GpuStats instance destructor needs to be called in advance.
+        mGpuStats.reset(nullptr);
         // performs all pending callbacks until all data has been consumed
         // gives time to process binder transactions by thread pool
         looper->pollAll(1000);