Skip to content

Commit

Permalink
Prevent a possible 'use after free' fault when using AsyncAppender (#397
Browse files Browse the repository at this point in the history
)

* Prefer thread_local over APR

* Provide a minimal Optional for C++11

* Document ThreadSpecificData methods

* Update the change report
  • Loading branch information
swebb2066 authored Jul 24, 2024
1 parent 1c1cd79 commit d925a2e
Show file tree
Hide file tree
Showing 11 changed files with 330 additions and 265 deletions.
8 changes: 2 additions & 6 deletions src/main/cpp/asyncappender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,8 @@ void AsyncAppender::append(const spi::LoggingEventPtr& event, Pool& p)
priv->appenders.appendLoopOnAppenders(event, p);
}

// Set the NDC and MDC for the calling thread as these
// LoggingEvent fields were not set at event creation time.
LogString ndcVal;
event->getNDC(ndcVal);
// Get a copy of this thread's MDC.
event->getMDCCopy();
// Get a copy of this thread's diagnostic context
event->LoadDC();

if (!priv->dispatcher.joinable())
{
Expand Down
Loading

0 comments on commit d925a2e

Please sign in to comment.