This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Fix memory leak in strstream tests.
ClosedPublic

Authored by EricWF on Nov 13 2014, 9:44 PM.

Details

Summary

The strstream function str() sets freeze(true). When freeze is true the destructor is not allowed to free any dynamically allocated memory. The memory leak causes ASAN to fail on these tests. To ensure memory is deallocated strstream.freeze(false) is called at the end of the tests.

Diff Detail

Event Timeline

EricWF updated this revision to Diff 16196.Nov 13 2014, 9:44 PM
EricWF retitled this revision from to [libcxx] Fix memory leak in strstream tests..
EricWF updated this object.
EricWF edited the test plan for this revision. (Show Details)
EricWF added reviewers: mclow.lists, danalbert.
EricWF added a subscriber: Unknown Object (MLST).
mclow.lists edited edge metadata.Nov 14 2014, 10:50 AM

What an ugly, leak-prone API. No wonder we deprecated it.

mclow.lists accepted this revision.Nov 14 2014, 11:01 AM
mclow.lists edited edge metadata.

I would love to see a better way to solve this; however, I don't see one, given the specification for strstream

This revision is now accepted and ready to land.Nov 14 2014, 11:01 AM
EricWF closed this revision.Nov 14 2014, 11:10 AM