[PATCH 4/4] winex11: Use libc for driver memory allocation.

Jacek Caban jacek at codeweavers.com
Mon Apr 25 10:03:49 CDT 2022


On 4/25/22 16:51, Huw Davies wrote:
> On Mon, Apr 25, 2022 at 03:49:09PM +0200, Jacek Caban wrote:
>> @@ -1352,11 +1354,11 @@ static BOOL export_hdrop( Display *display, Window win, Atom prop, Atom target,
>>           UINT u;
>>   
>>           dosFilenameSize = 1 + DragQueryFileW( handle, i, NULL, 0 );
>> -        dosFilename = HeapAlloc(GetProcessHeap(), 0, dosFilenameSize*sizeof(WCHAR));
>> +        dosFilename = malloc( dosFilenameSize * sizeof(WCHAR) );
>>           if (dosFilename == NULL) goto failed;
>>           DragQueryFileW( handle, i, dosFilename, dosFilenameSize );
>>           unixFilename = wine_get_unix_file_name(dosFilename);
>> -        HeapFree(GetProcessHeap(), 0, dosFilename);
>> +        free( dosFilename );
>>           if (unixFilename == NULL) goto failed;
>>           uriSize = 8 + /* file:/// */
>>                   3 * (lstrlenA(unixFilename) - 1) + /* "%xy" per char except first '/' */
>> @@ -1364,7 +1366,7 @@ static BOOL export_hdrop( Display *display, Window win, Atom prop, Atom target,
>>           if ((next + uriSize) > textUriListSize)
>>           {
>>               UINT biggerSize = max( 2 * textUriListSize, next + uriSize );
>> -            void *bigger = HeapReAlloc( GetProcessHeap(), 0, textUriList, biggerSize );
>> +            void *bigger = realloc( textUriList, biggerSize );
>>               if (bigger)
>>               {
>>                   textUriList = bigger;
>> @@ -1372,7 +1374,7 @@ static BOOL export_hdrop( Display *display, Window win, Atom prop, Atom target,
>>               }
>>               else
>>               {
>> -                HeapFree(GetProcessHeap(), 0, unixFilename);
>> +                free( unixFilename );
> unixFilename is returned by wine_get_unix_file_name() so is on the process heap.
> Likewise in the hunk below.


Good catch, there was also wine_get_dos_file_name. I have those 
converted in my WIP tree, but that's not yet ready for sending. 
Clipboard code will need quite a few changes...


Thanks,

Jacek




More information about the wine-devel mailing list