[PATCH] mshtml: Avoid potential moniker instance leak

Nikolay Sivov nsivov at codeweavers.com
Mon Dec 4 05:56:15 CST 2017


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/mshtml/persist.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c
index 25767ef57c..b82750a85e 100644
--- a/dlls/mshtml/persist.c
+++ b/dlls/mshtml/persist.c
@@ -918,10 +918,9 @@ static HRESULT WINAPI PersistStreamInit_Load(IPersistStreamInit *iface, IStream
 
     prepare_for_binding(This, mon, FALSE);
     hres = set_moniker(This->window, mon, NULL, NULL, NULL, TRUE);
-    if(FAILED(hres))
-        return hres;
+    if(SUCCEEDED(hres))
+        hres = channelbsc_load_stream(This->window->pending_window, mon, pStm);
 
-    hres = channelbsc_load_stream(This->window->pending_window, mon, pStm);
     IMoniker_Release(mon);
     return hres;
 }
@@ -976,10 +975,9 @@ static HRESULT WINAPI PersistStreamInit_InitNew(IPersistStreamInit *iface)
 
     prepare_for_binding(This, mon, FALSE);
     hres = set_moniker(This->window, mon, NULL, NULL, NULL, FALSE);
-    if(FAILED(hres))
-        return hres;
+    if(SUCCEEDED(hres))
+        hres = channelbsc_load_stream(This->window->pending_window, mon, NULL);
 
-    hres = channelbsc_load_stream(This->window->pending_window, mon, NULL);
     IMoniker_Release(mon);
     return hres;
 }
-- 
2.15.0




More information about the wine-devel mailing list