[tracing] free strdup'd memory
ASAN complained about this on another commit: https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Linux64%20ASAN/26688 causing revert: https://chromium-review.googlesource.com/c/v8/v8/+/1162122 Change-Id: I3bb16177be9d49496db024ce92fd4354b12d8cc3 Reviewed-on: https://chromium-review.googlesource.com/1187832 Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Commit-Queue: Ali Ijaz Sheikh <ofrobots@google.com> Cr-Commit-Position: refs/heads/master@{#55412}
This commit is contained in:
parent
855d4b48a2
commit
f9648465e1
@ -3,6 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "include/libplatform/v8-tracing.h"
|
||||
@ -42,7 +43,20 @@ v8::base::AtomicWord g_category_index = g_num_builtin_categories;
|
||||
|
||||
TracingController::TracingController() {}
|
||||
|
||||
TracingController::~TracingController() { StopTracing(); }
|
||||
TracingController::~TracingController() {
|
||||
StopTracing();
|
||||
|
||||
{
|
||||
// Free memory for category group names allocated via strdup.
|
||||
base::LockGuard<base::Mutex> lock(mutex_.get());
|
||||
for (size_t i = g_category_index - 1; i > g_num_builtin_categories; --i) {
|
||||
const char* group = g_category_groups[i];
|
||||
g_category_groups[i] = nullptr;
|
||||
free(const_cast<char*>(group));
|
||||
}
|
||||
g_category_index = g_num_builtin_categories;
|
||||
}
|
||||
}
|
||||
|
||||
void TracingController::Initialize(TraceBuffer* trace_buffer) {
|
||||
trace_buffer_.reset(trace_buffer);
|
||||
|
Loading…
Reference in New Issue
Block a user