Sven Baars : wbemprox: Fix multiple leaks in parse_path (Coverity).

Alexandre Julliard julliard at winehq.org
Mon Oct 7 17:02:14 CDT 2019


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

Author: Sven Baars <sven.wine at gmail.com>
Date:   Fri Oct  4 21:58:43 2019 +0200

wbemprox: Fix multiple leaks in parse_path (Coverity).

Signed-off-by: Sven Baars <sven.wine at gmail.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wbemprox/services.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/dlls/wbemprox/services.c b/dlls/wbemprox/services.c
index e1cd2466e4..5909c02e61 100644
--- a/dlls/wbemprox/services.c
+++ b/dlls/wbemprox/services.c
@@ -335,24 +335,42 @@ HRESULT parse_path( const WCHAR *str, struct path **ret )
         DWORD server_len = ARRAY_SIZE(server);
 
         p++;
-        if (*p != '\\') return WBEM_E_INVALID_OBJECT_PATH;
+        if (*p != '\\')
+        {
+            heap_free( path );
+            return WBEM_E_INVALID_OBJECT_PATH;
+        }
         p++;
 
         q = p;
         while (*p && *p != '\\') p++;
-        if (!*p) return WBEM_E_INVALID_OBJECT_PATH;
+        if (!*p)
+        {
+            heap_free( path );
+            return WBEM_E_INVALID_OBJECT_PATH;
+        }
 
         len = p - q;
         if (!GetComputerNameW( server, &server_len ) || server_len != len || wcsnicmp( q, server, server_len ))
+        {
+            heap_free( path );
             return WBEM_E_NOT_SUPPORTED;
+        }
 
         q = ++p;
         while (*p && *p != ':') p++;
-        if (!*p) return WBEM_E_INVALID_OBJECT_PATH;
+        if (!*p)
+        {
+            heap_free( path );
+            return WBEM_E_INVALID_OBJECT_PATH;
+        }
 
         len = p - q;
         if (len != ARRAY_SIZE(cimv2W) - 1 || wcsnicmp( q, cimv2W, ARRAY_SIZE(cimv2W) - 1 ))
+        {
+            heap_free( path );
             return WBEM_E_INVALID_NAMESPACE;
+        }
         p++;
     }
 




More information about the wine-cvs mailing list