Opened 19 years ago

Closed 18 years ago

#189 closed Bugs (Fixed)

tss::set(0) leads to double-free

Reported by: perfecthash Owned by: bill_kempf
Milestone: Component: None
Version: None Severity:
Keywords: Cc:

Description

This bug only occurs on non-pthreads platforms such as
Win32 where no automatic destructor is available.  I
declared a variable:

boost::thread_specific_ptr<X> pX;

and initialized it:

pX.reset(new X);

Later, I did

pX.reset();

Subsequently, when pX went out of scope, it tried to
delete the X instance again.  It's easy to see why. 
tss::set checks

if (value && m_cleanup) {
   update cleanup handler table
}

So if value is NULL, the original cleanup handler is
left lying around.

Change History (1)

comment:1 by perfecthash, 18 years ago

Status: assignedclosed
Logged In: YES 
user_id=173374

Looks like this got fixed in Boost 1.32, thanks!

Note: See TracTickets for help on using tickets.