Index: runtime/vm/timeline.cc |
diff --git a/runtime/vm/timeline.cc b/runtime/vm/timeline.cc |
index ecdd085124b9e29788d0b591c5ed7b623dd22022..57566c6647de37a473837f2faa650bcc9005bdcf 100644 |
--- a/runtime/vm/timeline.cc |
+++ b/runtime/vm/timeline.cc |
@@ -441,11 +441,9 @@ void TimelineEventRecorder::WriteTo(const char* directory) { |
TimelineEventFilter filter; |
PrintJSON(&js, &filter); |
- const char* format = "%s/dart-timeline-%" Pd ".json"; |
intptr_t pid = OS::ProcessId(); |
- intptr_t len = OS::SNPrint(NULL, 0, format, directory, pid); |
- char* filename = reinterpret_cast<char*>(malloc(len + 1)); |
- OS::SNPrint(filename, len + 1, format, directory, pid); |
+ char* filename = NULL; |
+ SNPRINT(filename, malloc, "%s/dart-timeline-%" Pd ".json", directory, pid); |
void* file = (*file_open)(filename, true); |
if (file == NULL) { |
OS::Print("Failed to write timeline file: %s\n", filename); |