[PATCH] [libcxx] Fix memory leak in strstream tests.

Eric Fiselier eric at efcs.ca
Thu Nov 13 21:44:38 PST 2014


Hi mclow.lists, danalbert,

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.

http://reviews.llvm.org/D6261

Files:
  test/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.cons/default.pass.cpp
  test/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.members/freeze.pass.cpp
  test/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.members/str.pass.cpp
  test/depr/depr.str.strstreams/depr.strstream/depr.strstream.cons/default.pass.cpp
  test/depr/depr.str.strstreams/depr.strstream/depr.strstream.oper/freeze.pass.cpp
  test/depr/depr.str.strstreams/depr.strstream/depr.strstream.oper/str.pass.cpp
  test/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/pcount.pass.cpp
  test/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/str.pass.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6261.16196.patch
Type: text/x-patch
Size: 4055 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141114/7b5fc0f0/attachment.bin>


More information about the cfe-commits mailing list