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

Huw Davies huw at codeweavers.com
Mon Apr 25 09:51:35 CDT 2022


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.

>                  goto failed;
>              }
>          }
> @@ -1388,14 +1390,14 @@ static BOOL export_hdrop( Display *display, Window win, Atom prop, Atom target,
>          }
>          textUriList[next++] = '\r';
>          textUriList[next++] = '\n';
> -        HeapFree(GetProcessHeap(), 0, unixFilename);
> +        free( unixFilename );
>      }




More information about the wine-devel mailing list