don't call inflateEnd if inflateInit failed

This fixes the following valgrind message:

==12572== Conditional jump or move depends on uninitialised value(s)
==12572==    at 0x1505C89C: inflateEnd (inflate.c:1258)
==12572==    by 0xD17644D: ZCodec::EndCompression() (zcodec.cxx:106)
==12572==    by 0xD17724E: ZCodec::AttemptDecompression(SvStream&, SvStream&) (zcodec.cxx:405)
==12572==    by 0x5F17020A: PlainTextFilterDetect::detect(com::sun::uno::Sequence<com::sun:🫘:PropertyValue>&) (filterdetect.cxx:157)
==12572==    by 0x3C3F098C: filter::config::TypeDetection::impl_askDetectService(rtl::OUString const&, utl::MediaDescriptor&) (typedetection.cxx:1040)
==12572==    by 0x3C3F0449: filter::config::TypeDetection::impl_detectTypeFlatAndDeep(utl::MediaDescriptor&, std::__debug::list<filter::config::FlatDetectionInfo, std::allocator<filter::config::FlatDetectionInfo> > const&, bool, std::__debug::vector<rtl::OUString, std::allocator<rtl::OUString> >&, rtl::OUString&) (typedetection.cxx:946)
==12572==    by 0x3C3ED6A1: filter::config::TypeDetection::queryTypeByDescriptor(com::sun::uno::Sequence<com::sun:🫘:PropertyValue>&, unsigned char) (typedetection.cxx:427)
==12572==    by 0x49B232CF: OwnView_Impl::GetFilterNameFromExtentionAndInStream(com::sun::uno::Reference<com::sun::lang::XMultiServiceFactory> const&, rtl::OUString const&, com::sun::uno::Reference<com::sun::io::XInputStream> const&) (ownview.cxx:219)
==12572==    by 0x49B011EB: OleEmbeddedObject::TryToConvertToOOo() (oleembed.cxx:268)
==12572==    by 0x49B03AD1: OleEmbeddedObject::doVerb(int) (oleembed.cxx:837)
==12572==    by 0x9F5C353: SfxInPlaceClient::DoVerb(long) (ipclient.cxx:946)
==12572==    by 0x402D395A: SwWrtShell::LaunchOLEObj(long) (wrtsh1.cxx:588)
==12572==

Change-Id: I51c0fbdc185897c60f6c0099b96c6ca9c25a35ba
This commit is contained in:
David Tardon 2016-10-07 16:29:36 +02:00
parent 866eb4a7f9
commit 18537bead9

View file

@ -336,7 +336,6 @@ void ZCodec::InitCompress()
void ZCodec::InitDecompress(SvStream & inStream)
{
assert(meState == STATE_INIT);
meState = STATE_DECOMPRESS;
if ( mbStatus && mbGzLib )
{
sal_uInt8 n1, n2, j, nMethod, nFlags;
@ -388,6 +387,8 @@ void ZCodec::InitDecompress(SvStream & inStream)
{
mbStatus = ( inflateInit( PZSTREAM ) >= 0 );
}
if ( mbStatus )
meState = STATE_DECOMPRESS;
mpInBuf = new sal_uInt8[ mnInBufSize ];
}