From 85013aae04f7af82fe17a4995a8b2655bf0e6358 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Thu, 9 Jul 2009 11:24:42 -0500 Subject: [PATCH] windowscodecs: don't leak memory when BmpFrameDecode_CopyPalette fails --- dlls/windowscodecs/bmpdecode.c | 20 ++++++++++++++------ 1 files changed, 14 insertions(+), 6 deletions(-) diff --git a/dlls/windowscodecs/bmpdecode.c b/dlls/windowscodecs/bmpdecode.c index 80447cf..ef17a9c 100644 --- a/dlls/windowscodecs/bmpdecode.c +++ b/dlls/windowscodecs/bmpdecode.c @@ -218,11 +218,14 @@ static HRESULT WINAPI BmpFrameDecode_CopyPalette(IWICBitmapFrameDecode *iface, offset.QuadPart = sizeof(BITMAPFILEHEADER)+sizeof(BITMAPCOREHEADER); hr = IStream_Seek(This->stream, offset, STREAM_SEEK_SET, NULL); - if (FAILED(hr)) return hr; + if (FAILED(hr)) goto core_end; hr = IStream_Read(This->stream, bgrcolors, tablesize, &bytesread); - if (FAILED(hr)) return hr; - if (bytesread != tablesize) return E_FAIL; + if (FAILED(hr)) goto core_end; + if (bytesread != tablesize) { + hr = E_FAIL; + goto core_end; + } for (i=0; ibih.bV5Size; hr = IStream_Seek(This->stream, offset, STREAM_SEEK_SET, NULL); - if (FAILED(hr)) return hr; + if (FAILED(hr)) goto info_end; hr = IStream_Read(This->stream, wiccolors, tablesize, &bytesread); - if (FAILED(hr)) return hr; - if (bytesread != tablesize) return E_FAIL; + if (FAILED(hr)) goto info_end; + if (bytesread != tablesize) { + hr = E_FAIL; + goto info_end; + } /* convert from BGR to BGRA by setting alpha to 100% */ for (i=0; i