ostream.tcc (operator<<(basic_ostream<>&, const char*)): Fix thinko in change for libstdc++/28277, avoid memory leaks.
2006-10-14 Paolo Carlini <pcarlini@suse.de> * include/bits/ostream.tcc (operator<<(basic_ostream<>&, const char*)): Fix thinko in change for libstdc++/28277, avoid memory leaks. From-SVN: r117729
This commit is contained in:
parent
14ba83a988
commit
78a438f161
2 changed files with 22 additions and 5 deletions
|
@ -1,3 +1,9 @@
|
|||
2006-10-14 Paolo Carlini <pcarlini@suse.de>
|
||||
|
||||
* include/bits/ostream.tcc (operator<<(basic_ostream<>&,
|
||||
const char*)): Fix thinko in change for libstdc++/28277,
|
||||
avoid memory leaks.
|
||||
|
||||
2006-10-13 Paolo Carlini <pcarlini@suse.de>
|
||||
|
||||
* include/bits/istream.tcc (operator>>(__istream_type&
|
||||
|
|
|
@ -320,19 +320,30 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
|||
__out.setstate(ios_base::badbit);
|
||||
else
|
||||
{
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// 167. Improper use of traits_type::length()
|
||||
const size_t __clen = char_traits<char>::length(__s);
|
||||
_CharT* __ws = 0;
|
||||
try
|
||||
{ __ws = new _CharT[__clen]; }
|
||||
catch(...)
|
||||
{
|
||||
__out._M_setstate(ios_base::badbit);
|
||||
return __out;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// 167. Improper use of traits_type::length()
|
||||
const size_t __clen = char_traits<char>::length(__s);
|
||||
_CharT* __ws = new _CharT[__clen];
|
||||
for (size_t __i = 0; __i < __clen; ++__i)
|
||||
__ws[__i] = __out.widen(__s[__i]);
|
||||
__out._M_insert(__ws, __clen);
|
||||
delete [] __ws;
|
||||
}
|
||||
catch(...)
|
||||
{ __out._M_setstate(ios_base::badbit); }
|
||||
{
|
||||
delete [] __ws;
|
||||
__throw_exception_again;
|
||||
}
|
||||
}
|
||||
return __out;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue