summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--perfprofd/perfprofdcore.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/perfprofd/perfprofdcore.cc b/perfprofd/perfprofdcore.cc
index 065f8e67..c5605ac7 100644
--- a/perfprofd/perfprofdcore.cc
+++ b/perfprofd/perfprofdcore.cc
@@ -36,6 +36,7 @@
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/macros.h>
+#include <android-base/scopeguard.h>
#include <android-base/stringprintf.h>
#ifdef __BIONIC__
@@ -650,6 +651,9 @@ static ProtoUniquePtr collect_profile(Config& config)
bool take_action = (hardwire && duration <= max_duration);
HardwireCpuHelper helper(take_action);
+ auto scope_guard = android::base::make_scope_guard(
+ [&data_file_path]() { unlink(data_file_path.c_str()); });
+
//
// Invoke perf
//