windowscodecs: Fix crash when PNG decoder is freed without successful init.

Vincent Povirk madewokherd at gmail.com
Fri Apr 10 12:28:08 CDT 2015


-------------- next part --------------
From 941d0d8963e329c1e0472b103d662877ccf37bc8 Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Fri, 10 Apr 2015 11:39:34 -0500
Subject: [PATCH] windowscodecs: Fix crash when PNG decoder is freed without
 successful init.

---
 dlls/windowscodecs/pngformat.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c
index 2aac560..f39b31a 100644
--- a/dlls/windowscodecs/pngformat.c
+++ b/dlls/windowscodecs/pngformat.c
@@ -442,7 +442,8 @@ static ULONG WINAPI PngDecoder_Release(IWICBitmapDecoder *iface)
 
     if (ref == 0)
     {
-        IStream_Release(This->stream);
+        if (This->stream)
+            IStream_Release(This->stream);
         if (This->png_ptr)
             ppng_destroy_read_struct(&This->png_ptr, &This->info_ptr, &This->end_info);
         This->lock.DebugInfo->Spare[0] = 0;
@@ -1218,6 +1219,7 @@ HRESULT PngDecoder_CreateInstance(REFIID iid, void** ppv)
     This->png_ptr = NULL;
     This->info_ptr = NULL;
     This->end_info = NULL;
+    This->stream = NULL;
     This->initialized = FALSE;
     This->image_bits = NULL;
     InitializeCriticalSection(&This->lock);
-- 
2.1.0



More information about the wine-patches mailing list