Fix more unicode/memory allocation errors in wininet

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




ChangeLog: * Fix more unicode/memory allocation errors in wininet
Index: dlls/wininet/ftp.c
===================================================================
RCS file: /home/wine/wine/dlls/wininet/ftp.c,v
retrieving revision 1.32
diff -u -r1.32 ftp.c
--- dlls/wininet/ftp.c	5 Sep 2003 23:08:28 -0000	1.32
+++ dlls/wininet/ftp.c	23 Sep 2003 02:10:57 -0000
@@ -326,12 +326,13 @@
     INT len;
     BOOL rc;
 
-    len = lstrlenW(lpszDirectory)+1;
-    if (!(szDir = (CHAR *)malloc(len*sizeof(CHAR))))
+    len = WideCharToMultiByte(CP_ACP, 0, lpszDirectory, -1, NULL, 0, NULL, NULL);
+    szDir = HeapAlloc(GetProcessHeap(), 0, len);
+    if(!szDir)
         return FALSE;
-    WideCharToMultiByte(CP_ACP, -1, lpszDirectory, -1, szDir, len, NULL, NULL);
+    WideCharToMultiByte(CP_ACP, 0, lpszDirectory, -1, szDir, len, NULL, NULL);
     rc = FtpSetCurrentDirectoryA(hConnect, szDir);
-    free(szDir);
+    HeapFree(GetProcessHeap(), 0, szDir);
 
     return rc;
 }
@@ -450,12 +451,13 @@
     INT len;
     BOOL rc;
 
-    len = lstrlenW(lpszDirectory)+1;
-    if (!(szDir = (CHAR *)malloc(len*sizeof(CHAR))))
+    len = WideCharToMultiByte(CP_ACP, 0, lpszDirectory, -1, NULL, 0, NULL, NULL);
+    szDir = HeapAlloc(GetProcessHeap(), 0, len);
+    if (!szDir)
         return FALSE;
-    WideCharToMultiByte(CP_ACP, -1, lpszDirectory, -1, szDir, len, NULL, NULL);
+    WideCharToMultiByte(CP_ACP, 0, lpszDirectory, -1, szDir, len, NULL, NULL);
     rc = FtpCreateDirectoryA(hConnect, szDir);
-    free(szDir);
+    HeapFree(GetProcessHeap(), 0, szDir);
 
     return rc;
 }

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux