Ensure that the temporary will be deleted.
(cherry picked from commit
529af96ba77f26c1597d077ca55d051feeb5df3d)
Bug:
73175642
Test: perfprofd_test
Merged-In: I4e15cd4fa81a173a70126edaea5c0a0023b8c359
Change-Id: I4e15cd4fa81a173a70126edaea5c0a0023b8c359
#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__
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
//