diff options
-rw-r--r-- | libstdc++-v3/ChangeLog | 5 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/ostream.tcc | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index f286f68..0609457 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,6 +1,11 @@ 2006-10-14 Paolo Carlini <pcarlini@suse.de> * include/bits/ostream.tcc (operator<<(basic_ostream<>&, + const char*)): Further fix for throwing widen. + +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. diff --git a/libstdc++-v3/include/bits/ostream.tcc b/libstdc++-v3/include/bits/ostream.tcc index 125e0fe..db09d0a 100644 --- a/libstdc++-v3/include/bits/ostream.tcc +++ b/libstdc++-v3/include/bits/ostream.tcc @@ -325,17 +325,20 @@ _GLIBCXX_BEGIN_NAMESPACE(std) const size_t __clen = char_traits<char>::length(__s); _CharT* __ws = 0; try - { __ws = new _CharT[__clen]; } + { + __ws = new _CharT[__clen]; + for (size_t __i = 0; __i < __clen; ++__i) + __ws[__i] = __out.widen(__s[__i]); + } catch(...) { + delete [] __ws; __out._M_setstate(ios_base::badbit); return __out; } try { - for (size_t __i = 0; __i < __clen; ++__i) - __ws[__i] = __out.widen(__s[__i]); __out._M_insert(__ws, __clen); delete [] __ws; } |