[PATCH 4/5] winepath: Use CRT allocation functions.

Nikolay Sivov wine at gitlab.winehq.org
Tue Jul 5 01:48:23 CDT 2022


From: Nikolay Sivov <nsivov at codeweavers.com>

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 programs/winepath/winepath.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/programs/winepath/winepath.c b/programs/winepath/winepath.c
index 17cfdc1d2eb..88c64b91a42 100644
--- a/programs/winepath/winepath.c
+++ b/programs/winepath/winepath.c
@@ -195,7 +195,7 @@ int __cdecl wmain(int argc, WCHAR *argv[])
         if (outputformats & UNIXFORMAT) {
             WCHAR *ntpath, *tail;
             int ntpathlen=lstrlenW(argv[i]);
-            ntpath=HeapAlloc(GetProcessHeap(), 0, sizeof(*ntpath)*(ntpathlen+1));
+            ntpath = malloc(sizeof(*ntpath)*(ntpathlen+1));
             lstrcpyW(ntpath, argv[i]);
             tail=NULL;
             while (1)
@@ -215,7 +215,7 @@ int __cdecl wmain(int argc, WCHAR *argv[])
                     {
                         printf("%s%c", unix_name, separator);
                     }
-                    HeapFree( GetProcessHeap(), 0, unix_name );
+                    free( unix_name );
                     break;
                 }
 
@@ -247,7 +247,7 @@ int __cdecl wmain(int argc, WCHAR *argv[])
                 tail=slash;
                 *tail='\0';
             }
-            HeapFree(GetProcessHeap(), 0, ntpath);
+            free(ntpath);
         }
         if (outputformats & WINDOWSFORMAT) {
             WCHAR* windows_name;
@@ -255,17 +255,17 @@ int __cdecl wmain(int argc, WCHAR *argv[])
             DWORD size;
 
             size=WideCharToMultiByte(CP_UNIXCP, 0, argv[i], -1, NULL, 0, NULL, NULL);
-            unix_name=HeapAlloc(GetProcessHeap(), 0, size);
+            unix_name = malloc(size);
             WideCharToMultiByte(CP_UNIXCP, 0, argv[i], -1, unix_name, size, NULL, NULL);
 
             if ((windows_name = wine_get_dos_file_name_ptr(unix_name)))
             {
                 WideCharToMultiByte(CP_UNIXCP, 0, windows_name, -1, path, MAX_PATH, NULL, NULL);
                 printf("%s%c", path, separator);
-                HeapFree( GetProcessHeap(), 0, windows_name );
+                free( windows_name );
             }
             else printf("%c", separator);
-            HeapFree( GetProcessHeap(), 0, unix_name );
+            free( unix_name );
         }
     }
 
-- 
GitLab


https://gitlab.winehq.org/wine/wine/-/merge_requests/378



More information about the wine-devel mailing list