boost gzip_decompressor()free()上的分段错误

时间:2012-02-05 13:02:55

标签: c++ boost gzip

我正在使用来自boost库的gzip_decompressor(),但我在free()上遇到一个奇怪的Segmentation错误。

stringstream gzMessage;
stringstream rawMessage;
gzMessage << (*iter)->message;
filtering_streambuf<input> gzFilter;
gzFilter.push(gzip_decompressor());
gzFilter.push(gzMessage);

boost::iostreams::copy(gzFilter, rawMessage);

message = rawMessage.str();
cout << "ungzipped: " << message << endl;

有问题的行是boost :: iostreams :: copy(gzFilter,rawMessage); 如果我评论这一切一切正常。

回溯:

(gdb) bt
#0  0x00007ffff640fd29 in free () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x0000000000453f8c in boost::detail::sp_counted_impl_p<boost::iostreams::symmetric_filter<boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> >, std::allocator<char> >::impl>::dispose()
    ()
#2  0x0000000000427f49 in boost::detail::shared_count::~shared_count() ()
#3  0x00000000004598ae in boost::iostreams::stream_buffer<boost::iostreams::basic_gzip_decompressor<std::allocator<char> >, std::char_traits<char>, std::allocator<char>, boost::iostreams::input>::~stream_buffer() ()
#4  0x0000000000459c39 in boost::iostreams::detail::chain_base<boost::iostreams::chain<boost::iostreams::input, char, std::char_traits<char>, std::allocator<char> >, char, std::char_traits<char>, std::allocator<char>, boost::iostreams::input>::chain_impl::~chain_impl() ()
#5  0x0000000000459d12 in boost::detail::sp_counted_impl_p<boost::iostreams::detail::chain_base<boost::iostreams::chain<boost::iostreams::input, char, std::char_traits<char>, std::allocator<char> >, char, std::char_traits<char>, std::allocator<char>, boost::iostreams::input>::chain_impl>::dispose() ()
#6  0x0000000000427f49 in boost::detail::shared_count::~shared_count() ()

任何提示?

0 个答案:

没有答案