[PATCH] msxml3: Fix uri object leak on error path (Valgrind).

Nikolay Sivov nsivov at codeweavers.com
Sun Dec 16 23:16:14 CST 2018


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/msxml3/domdoc.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c
index 445caaee69..76d3fdb601 100644
--- a/dlls/msxml3/domdoc.c
+++ b/dlls/msxml3/domdoc.c
@@ -2292,8 +2292,8 @@ static HRESULT WINAPI domdoc_load(
 
     if ( filename )
     {
+        IUri *uri = NULL;
         IMoniker *mon;
-        IUri *uri;
 
         if (This->properties->uri)
         {
@@ -2310,15 +2310,19 @@ static HRESULT WINAPI domdoc_load(
             IMoniker_Release(mon);
         }
 
-        if ( FAILED(hr) )
-            This->error = E_FAIL;
-        else
+        if (SUCCEEDED(hr))
         {
             get_doc(This)->name = (char *)xmlchar_from_wcharn(filename, -1, TRUE);
             This->properties->uri = uri;
             hr = This->error = S_OK;
             *isSuccessful = VARIANT_TRUE;
         }
+        else
+        {
+            if (uri)
+                IUri_Release(uri);
+            This->error = E_FAIL;
+        }
     }
 
     if(!filename || FAILED(hr)) {
-- 
2.19.2




More information about the wine-devel mailing list