Dmitry Timoshkov : windowscodecs: Fix memory leak in error case.

Alexandre Julliard julliard at winehq.org
Tue Jul 31 12:04:15 CDT 2012


Module: wine
Branch: master
Commit: 127b502ce7e041b52e7da1baa424123367a4fb1f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=127b502ce7e041b52e7da1baa424123367a4fb1f

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Tue Jul 31 16:17:42 2012 +0900

windowscodecs: Fix memory leak in error case.

---

 dlls/windowscodecs/palette.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

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);




More information about the wine-cvs mailing list