[PATCH 4/4] winex11: Use libc for driver memory allocation.
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> --- dlls/winex11.drv/bitblt.c | 22 +++---- dlls/winex11.drv/brush.c | 3 +- dlls/winex11.drv/clipboard.c | 110 ++++++++++++++++----------------- dlls/winex11.drv/desktop.c | 17 +++-- dlls/winex11.drv/graphics.c | 59 +++++++++--------- dlls/winex11.drv/init.c | 4 +- dlls/winex11.drv/keyboard.c | 10 +-- dlls/winex11.drv/mouse.c | 26 ++++---- dlls/winex11.drv/opengl.c | 36 +++++------ dlls/winex11.drv/palette.c | 29 +++++---- dlls/winex11.drv/pen.c | 4 +- dlls/winex11.drv/settings.c | 25 ++++---- dlls/winex11.drv/vulkan.c | 13 ++-- dlls/winex11.drv/window.c | 47 +++++++------- dlls/winex11.drv/x11drv_main.c | 13 ++-- dlls/winex11.drv/xinerama.c | 17 +++-- dlls/winex11.drv/xrandr.c | 45 ++++++-------- dlls/winex11.drv/xrender.c | 79 +++++++++-------------- dlls/winex11.drv/xvidmode.c | 13 ++-- 19 files changed, 268 insertions(+), 304 deletions(-)
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 ); }
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
participants (2)
-
Huw Davies -
Jacek Caban