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
Index: test/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.cons/default.pass.cpp
===================================================================
--- test/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.cons/default.pass.cpp
+++ test/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.cons/default.pass.cpp
@@ -24,4 +24,5 @@
     std::string s("dog");
     out << i << ' ' << d << ' ' << s << std::ends;
     assert(out.str() == std::string("123 4.5 dog"));
+    out.freeze(false);
 }
Index: test/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.members/freeze.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/freeze.pass.cpp
@@ -29,5 +29,6 @@
         out << 'a';
         out << char(0);
         assert(out.str() == std::string("a"));
+        out.freeze(false);
     }
 }
Index: test/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.members/str.pass.cpp
===================================================================
--- test/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.members/str.pass.cpp
+++ test/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.members/str.pass.cpp
@@ -22,5 +22,6 @@
         std::ostrstream out;
         out << 123 << ' ' << 4.5 << ' ' << "dog" << std::ends;
         assert(out.str() == std::string("123 4.5 dog"));
+        out.freeze(false);
     }
 }
Index: test/depr/depr.str.strstreams/depr.strstream/depr.strstream.cons/default.pass.cpp
===================================================================
--- test/depr/depr.str.strstreams/depr.strstream/depr.strstream.cons/default.pass.cpp
+++ test/depr/depr.str.strstreams/depr.strstream/depr.strstream.cons/default.pass.cpp
@@ -31,4 +31,5 @@
     assert(i == 123);
     assert(d == 4.5);
     assert(strcmp(s.c_str(), "dog") == 0);
+    inout.freeze(false);
 }
Index: test/depr/depr.str.strstreams/depr.strstream/depr.strstream.oper/freeze.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/freeze.pass.cpp
@@ -29,5 +29,6 @@
         out << 'a';
         out << char(0);
         assert(out.str() == std::string("a"));
+        out.freeze(false);
     }
 }
Index: test/depr/depr.str.strstreams/depr.strstream/depr.strstream.oper/str.pass.cpp
===================================================================
--- test/depr/depr.str.strstreams/depr.strstream/depr.strstream.oper/str.pass.cpp
+++ test/depr/depr.str.strstreams/depr.strstream/depr.strstream.oper/str.pass.cpp
@@ -22,5 +22,6 @@
         std::strstream out;
         out << 123 << ' ' << 4.5 << ' ' << "dog" << std::ends;
         assert(out.str() == std::string("123 4.5 dog"));
+        out.freeze(false);
     }
 }
Index: test/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/pcount.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/pcount.pass.cpp
@@ -27,5 +27,6 @@
         assert(sb.pcount() == 2);
         assert(sb.str() == std::string("a"));
         assert(sb.pcount() == 2);
+        sb.freeze(false);
     }
 }
Index: test/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/str.pass.cpp
===================================================================
--- test/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/str.pass.cpp
+++ test/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/str.pass.cpp
@@ -23,5 +23,6 @@
         assert(sb.sputc('a') == 'a');
         assert(sb.sputc(0) == 0);
         assert(sb.str() == std::string("a"));
+        sb.freeze(false);
     }
 }
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to