mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-10 20:39:58 +08:00
re PR libstdc++/57914 (Memory leak in __cxa_thread_atexit when using thread_local)
PR libstdc++/57914 * libsupc++/atexit_thread.cc (run): Delete cleanup elts. From-SVN: r201146
This commit is contained in:
parent
fb4149396a
commit
16a1d8fe29
@ -1,3 +1,8 @@
|
||||
2013-07-22 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR libstdc++/57914
|
||||
* libsupc++/atexit_thread.cc (run): Delete cleanup elts.
|
||||
|
||||
2013-07-22 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/57920
|
||||
|
@ -58,8 +58,13 @@ namespace {
|
||||
void run (void *p)
|
||||
{
|
||||
elt *e = static_cast<elt*>(p);
|
||||
for (; e; e = e->next)
|
||||
e->destructor (e->object);
|
||||
while (e)
|
||||
{
|
||||
elt *old_e = e;
|
||||
e->destructor (e->object);
|
||||
e = e->next;
|
||||
delete (old_e);
|
||||
}
|
||||
}
|
||||
|
||||
// Run the stack of cleanups for the current thread.
|
||||
@ -67,9 +72,15 @@ namespace {
|
||||
{
|
||||
void *e;
|
||||
if (__gthread_active_p ())
|
||||
e = __gthread_getspecific (key);
|
||||
{
|
||||
e = __gthread_getspecific (key);
|
||||
__gthread_setspecific (key, NULL);
|
||||
}
|
||||
else
|
||||
e = single_thread;
|
||||
{
|
||||
e = single_thread;
|
||||
single_thread = NULL;
|
||||
}
|
||||
run (e);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user