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/logging/interface.cc b/aos/logging/interface.cc
index e6e9203..6a201aa 100644
--- a/aos/logging/interface.cc
+++ b/aos/logging/interface.cc
@@ -35,11 +35,12 @@
     ::std::function<void(LogImplementation *)> function) {
   Context *context = Context::Get();
 
-  LogImplementation *const implementation = context->implementation;
+  const std::shared_ptr<LogImplementation> implementation =
+      context->implementation;
   if (implementation == NULL) {
     Die("no logging implementation to use\n");
   }
-  function(implementation);
+  function(implementation.get());
 }
 
 }  // namespace internal