Nikolay Sivov : wmic: Use CRT allocation functions.

Alexandre Julliard julliard at winehq.org
Thu Apr 7 16:19:07 CDT 2022


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Apr  7 12:27:53 2022 +0300

wmic: Use CRT allocation functions.

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

---

 programs/wmic/main.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/programs/wmic/main.c b/programs/wmic/main.c
index 50c28ebec5d..15b590098e7 100644
--- a/programs/wmic/main.c
+++ b/programs/wmic/main.c
@@ -61,15 +61,6 @@ static const WCHAR *find_class( const WCHAR *alias )
     return NULL;
 }
 
-static inline WCHAR *strdupW( const WCHAR *src )
-{
-    WCHAR *dst;
-    if (!src) return NULL;
-    if (!(dst = HeapAlloc( GetProcessHeap(), 0, (lstrlenW( src ) + 1) * sizeof(WCHAR) ))) return NULL;
-    lstrcpyW( dst, src );
-    return dst;
-}
-
 static WCHAR *find_prop( IWbemClassObject *class, const WCHAR *prop )
 {
     SAFEARRAY *sa;
@@ -85,7 +76,7 @@ static WCHAR *find_prop( IWbemClassObject *class, const WCHAR *prop )
         SafeArrayGetElement( sa, &i, &str );
         if (!wcsicmp( str, prop ))
         {
-            ret = strdupW( str );
+            ret = wcsdup( str );
             break;
         }
     }
@@ -228,7 +219,7 @@ done:
     SysFreeString( path );
     SysFreeString( query );
     SysFreeString( wql );
-    HeapFree( GetProcessHeap(), 0, prop );
+    free( prop );
     CoUninitialize();
     return ret;
 }




More information about the wine-cvs mailing list