fix potential memory leak in ThreadLocal
authorPhilip Pronin <philipp@fb.com>
Fri, 14 Nov 2014 22:00:47 +0000 (14:00 -0800)
committerDave Watson <davejwatson@fb.com>
Wed, 19 Nov 2014 20:52:25 +0000 (12:52 -0800)
commit81fa7fd7ac3de80e645dae5243987f05049627b5
tree81a3ed7291478434732892274856903fac1579ce
parent22b02d5f8cb26f973e1ac2632ac8ac4c095ab02a
fix potential memory leak in ThreadLocal

Summary:
See this LSan abort: https://phabricator.fb.com/P17233565.

Destructor of the object stored in `folly::ThreadLocal` itself may be using
`folly::ThreadLocal` with the same tag, with the current implementation these
objects may escape cleanup happening on thread exit.

Test Plan:
_build/opt/folly/test/thread_local_test --gtest_filter=ThreadLocalPtr.CreateOnThreadExit

Reviewed By: lucian@fb.com

Subscribers: njormrod, folly-diffs@

FB internal diff: D1682698

Tasks: 5596043

Signature: t1:1682698:1416006810:100aaa5c17cecceeea568165d552d9d7907f38d0
folly/detail/ThreadLocalDetail.h
folly/test/ThreadLocalTest.cpp