diff options
author | Jason Ginchereau <jasongin@microsoft.com> | 2017-01-04 15:21:26 -0800 |
---|---|---|
committer | Michael Zasso <mzasso@localhost.localdomain> | 2017-01-07 13:56:43 +0100 |
commit | 58c38c2d2e6f4db57396dbe17a88b630a94f49f5 (patch) | |
tree | b4a0fcf4d1f358cdb7407a64cba166c1b935da6d /src/tracing/agent.cc | |
parent | a5bdcc39ac1353c37c12fd9b2bc11d6509b3c8bf (diff) | |
download | android-node-v8-58c38c2d2e6f4db57396dbe17a88b630a94f49f5.tar.gz android-node-v8-58c38c2d2e6f4db57396dbe17a88b630a94f49f5.tar.bz2 android-node-v8-58c38c2d2e6f4db57396dbe17a88b630a94f49f5.zip |
src: fix TracingController cleanup
This fixes an incorrect deletion of the `TracingController` instance,
which in some environments could cause an error about an invalid
pointer passed to `free()`. The `TracingController` instance is
actually owned by a `unique_ptr` member of the platform, so calling
`platform::SetTracingController(nullptr)` is the correct way to
delete it. But before that, the `TraceBuffer` must be deleted in
order for the tracing loop to exit; that is accomplished by calling
`TracingController::Initialize(nullptr)`.
PR-URL: https://github.com/nodejs/node/pull/10623
Reviewed-By: Matthew Loring <mattloring@google.com>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Diffstat (limited to 'src/tracing/agent.cc')
-rw-r--r-- | src/tracing/agent.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/tracing/agent.cc b/src/tracing/agent.cc index 97a3e11a2c..ceab09e5a2 100644 --- a/src/tracing/agent.cc +++ b/src/tracing/agent.cc @@ -56,7 +56,9 @@ void Agent::Stop() { // Perform final Flush on TraceBuffer. We don't want the tracing controller // to flush the buffer again on destruction of the V8::Platform. tracing_controller_->StopTracing(); - delete tracing_controller_; + tracing_controller_->Initialize(nullptr); + tracing_controller_ = nullptr; + // Thread should finish when the tracing loop is stopped. uv_thread_join(&thread_); v8::platform::SetTracingController(platform_, nullptr); |