logd: switch asprintf to std::string

Bug: 23350706
Change-Id: I715cdd4563a09de3680081947a3439f0cac623be
diff --git a/logd/LogStatistics.cpp b/logd/LogStatistics.cpp
index 578dee5..61fd559 100644
--- a/logd/LogStatistics.cpp
+++ b/logd/LogStatistics.cpp
@@ -20,8 +20,6 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <string>
-
 #include <base/stringprintf.h>
 #include <log/logger.h>
 #include <private/android_filesystem_config.h>
@@ -206,14 +204,9 @@
     }
 }
 
-void LogStatistics::format(char **buf, uid_t uid, unsigned int logMask) {
+std::string LogStatistics::format(uid_t uid, unsigned int logMask) {
     static const unsigned short spaces_total = 19;
 
-    if (*buf) {
-        free(*buf);
-        *buf = NULL;
-    }
-
     // Report on total logging, current and for all time
 
     std::string output = "size/num";
@@ -514,7 +507,7 @@
         }
     }
 
-    *buf = strdup(output.c_str());
+    return output;
 }
 
 namespace android {