Skip to content

stream_base,tls_wrap: notify on destruct

Classes like TLSWrap are given a pointer to a StreamBase instance; stored on the private member TLSWrap::stream_. Unfortunately the lifetime of stream_ is not reported to the TLSWrap instance and if free'd will leave an invalid pointer; which can still be accessed by the TLSWrap instance. Causing the application to segfault if accessed.

Give StreamBase a destruct callback to notify when the class is being cleaned up. Use this in TLSWrap to set stream_ = nullptr.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows [commit guidelines][]
Affected core subsystem(s)

stream_base, tls_wrap

CI: https://ci.nodejs.org/job/node-test-commit/8575/

Merge request reports

Loading