Actually manage memory in the old-style AOS logging

LeakSanitizer should be happy with it now. It's also still just as
thread-safe.

Change-Id: Id09a0349657cf4f719267b053f0ea3d8ec366256
diff --git a/aos/mutex/mutex_test.cc b/aos/mutex/mutex_test.cc
index bd47ae0..07de9dc 100644
--- a/aos/mutex/mutex_test.cc
+++ b/aos/mutex/mutex_test.cc
@@ -71,7 +71,8 @@
   test_mutex_.Unlock();
   EXPECT_DEATH(
       {
-        logging::SetImplementation(new util::DeathTestLogImplementation());
+        logging::SetImplementation(
+            std::make_shared<util::DeathTestLogImplementation>());
         test_mutex_.Unlock();
       },
       ".*multiple unlock.*");
@@ -82,7 +83,8 @@
   logging::Init();
   EXPECT_DEATH(
       {
-        logging::SetImplementation(new util::DeathTestLogImplementation());
+        logging::SetImplementation(
+            std::make_shared<util::DeathTestLogImplementation>());
         test_mutex_.Unlock();
       },
       ".*multiple unlock.*");
@@ -92,7 +94,8 @@
 TEST_F(MutexDeathTest, RepeatLock) {
   EXPECT_DEATH(
       {
-        logging::SetImplementation(new util::DeathTestLogImplementation());
+        logging::SetImplementation(
+            std::make_shared<util::DeathTestLogImplementation>());
         ASSERT_FALSE(test_mutex_.Lock());
         ASSERT_FALSE(test_mutex_.Lock());
       },
@@ -107,9 +110,7 @@
       static_cast<Mutex *>(shm_malloc_aligned(sizeof(Mutex), alignof(Mutex)));
   new (mutex) Mutex();
 
-  std::thread thread([&]() {
-    ASSERT_FALSE(mutex->Lock());
-  });
+  std::thread thread([&]() { ASSERT_FALSE(mutex->Lock()); });
   thread.join();
   EXPECT_TRUE(mutex->Lock());
 
@@ -124,9 +125,7 @@
       static_cast<Mutex *>(shm_malloc_aligned(sizeof(Mutex), alignof(Mutex)));
   new (mutex) Mutex();
 
-  std::thread thread([&]() {
-    ASSERT_FALSE(mutex->Lock());
-  });
+  std::thread thread([&]() { ASSERT_FALSE(mutex->Lock()); });
   thread.join();
   EXPECT_EQ(Mutex::State::kOwnerDied, mutex->TryLock());
 
@@ -245,13 +244,12 @@
       static_cast<Mutex *>(shm_malloc_aligned(sizeof(Mutex), alignof(Mutex)));
   new (mutex) Mutex();
 
-  std::thread thread([&]() {
-    ASSERT_FALSE(mutex->Lock());
-  });
+  std::thread thread([&]() { ASSERT_FALSE(mutex->Lock()); });
   thread.join();
   EXPECT_DEATH(
       {
-        logging::SetImplementation(new util::DeathTestLogImplementation());
+        logging::SetImplementation(
+            std::make_shared<util::DeathTestLogImplementation>());
         MutexLocker locker(mutex);
       },
       ".*previous owner of mutex [^ ]+ died.*");
@@ -313,9 +311,7 @@
       static_cast<Mutex *>(shm_malloc_aligned(sizeof(Mutex), alignof(Mutex)));
   new (mutex) Mutex();
 
-  std::thread thread([&]() {
-    ASSERT_FALSE(mutex->Lock());
-  });
+  std::thread thread([&]() { ASSERT_FALSE(mutex->Lock()); });
   thread.join();
   {
     aos::IPCMutexLocker locker(mutex);