Nikolay Sivov : msxml3: Fix uri object leak on error path (Valgrind).

Alexandre Julliard julliard at winehq.org
Mon Dec 17 15:36:38 CST 2018


Module: wine
Branch: master
Commit: 5825ad56f65ae052e6ed26f73c6672357c8af59d
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=5825ad56f65ae052e6ed26f73c6672357c8af59d

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Dec 17 08:16:14 2018 +0300

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

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 445caae..76d3fdb 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)) {




More information about the wine-cvs mailing list