windowscodecs: Fix memory leak in error case.
Dmitry Timoshkov
dmitry at baikal.ru
Tue Jul 31 02:17:42 CDT 2012
---
dlls/windowscodecs/palette.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/dlls/windowscodecs/palette.c b/dlls/windowscodecs/palette.c
index 7d50d83..f033012 100644
--- a/dlls/windowscodecs/palette.c
+++ b/dlls/windowscodecs/palette.c
@@ -476,7 +476,11 @@ static HRESULT WINAPI PaletteImpl_InitializeFromPalette(IWICPalette *iface,
colors = HeapAlloc(GetProcessHeap(), 0, sizeof(WICColor) * count);
if (!colors) return E_OUTOFMEMORY;
hr = IWICPalette_GetColors(source, count, colors, &count);
- if (hr != S_OK) return hr;
+ if (hr != S_OK)
+ {
+ HeapFree(GetProcessHeap(), 0, colors);
+ return hr;
+ }
}
EnterCriticalSection(&This->lock);
--
1.7.11.2
More information about the wine-patches
mailing list