Fix potential memory leaks
Bug: 259995529
Test: make tidy-art-tools-dmtracedump_subset
Change-Id: Ibe3ea77edcef9d1416aea844619e4d1084372d38
diff --git a/tools/dmtracedump/createtesttrace.cc b/tools/dmtracedump/createtesttrace.cc
index 444cce4..d55b3e4 100644
--- a/tools/dmtracedump/createtesttrace.cc
+++ b/tools/dmtracedump/createtesttrace.cc
@@ -22,6 +22,7 @@
#include <assert.h>
#include <ctype.h>
#include <errno.h>
+#include <memory>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -143,7 +144,7 @@
/* Add space for a sentinel record at the end */
numRecords += 1;
records = new dataRecord[numRecords];
- stack* callStack = new stack[numThreads];
+ std::unique_ptr<stack[]> callStack(new stack[numThreads]);
for (int32_t ii = 0; ii < numThreads; ++ii) {
callStack[ii].frames = nullptr;
callStack[ii].indentLevel = 0;