[PATCH] gdiplus: Fix a memory leak on error path (Valgrind).

Sven Baars sven.wine at gmail.com
Thu Jan 24 04:59:47 CST 2019


Signed-off-by: Sven Baars <sven.wine at gmail.com>
---
 dlls/gdiplus/image.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
index 2e844cfcc5..8a136eff09 100644
--- a/dlls/gdiplus/image.c
+++ b/dlls/gdiplus/image.c
@@ -3570,7 +3570,11 @@ static GpStatus initialize_decoder_wic(IStream *stream, REFGUID container, IWICB
     if (FAILED(hr)) return hresult_to_status(hr);
 
     hr = IWICBitmapDecoder_Initialize(*decoder, stream, WICDecodeMetadataCacheOnLoad);
-    if (FAILED(hr)) return hresult_to_status(hr);
+    if (FAILED(hr))
+    {
+        IWICBitmapDecoder_Release(*decoder);
+        return hresult_to_status(hr);
+    }
     return Ok;
 }
 
-- 
2.17.1




More information about the wine-devel mailing list