Removed malloc while logging.
Change-Id: Ifc5d8f7491a35aa27880af1d0d679c6a81b43b13
diff --git a/aos/common/logging/queue_logging-tmpl.h b/aos/common/logging/queue_logging-tmpl.h
index e0a89e4..b4c3696 100644
--- a/aos/common/logging/queue_logging-tmpl.h
+++ b/aos/common/logging/queue_logging-tmpl.h
@@ -8,11 +8,11 @@
template <class T>
void DoLogStruct(log_level level, const ::std::string &message,
const T &structure) {
+ auto fn = [&structure](char *buffer)
+ -> size_t { return structure.Serialize(buffer); };
+
LogImplementation::DoLogStruct(level, message, T::Size(), T::GetType(),
- [&structure](char * buffer)->size_t{
- return structure.Serialize(buffer);
- },
- 1);
+ ::std::ref(fn), 1);
}
} // namespace logging