diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cbc45ea..8a45ab7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed + +- Fixed a minor memory leak in the Wine->X11 drag-and-drop implementation when + converting Windows file paths. + ### yabridgectl - Added support for setting up CLAP plugins. diff --git a/src/wine-host/xdnd-proxy.cpp b/src/wine-host/xdnd-proxy.cpp index f860c00f..2d404aa2 100644 --- a/src/wine-host/xdnd-proxy.cpp +++ b/src/wine-host/xdnd-proxy.cpp @@ -847,7 +847,7 @@ void CALLBACK dnd_winevent_callback(HWINEVENTHOOK /*hWinEventHook*/, // Normalize the paths to something a bit more // friendly - const char* unix_path = + char* unix_path = wine_get_unix_file_name(file_name.data()); if (unix_path) { std::error_code err; @@ -860,6 +860,10 @@ void CALLBACK dnd_winevent_callback(HWINEVENTHOOK /*hWinEventHook*/, dragged_files.emplace_back( cannonical_path); } + + // Can't use regular `free()` or + // `unique_ptr` here + HeapFree(GetProcessHeap(), 0, unix_path); } } @@ -873,7 +877,7 @@ void CALLBACK dnd_winevent_callback(HWINEVENTHOOK /*hWinEventHook*/, } } break; case TYMED_FILE: { - const char* unix_path = + char* unix_path = wine_get_unix_file_name(storage.lpszFileName); if (unix_path) { std::error_code err; @@ -884,6 +888,8 @@ void CALLBACK dnd_winevent_callback(HWINEVENTHOOK /*hWinEventHook*/, } else { dragged_files.emplace_back(cannonical_path); } + + HeapFree(GetProcessHeap(), 0, unix_path); } } break; default: {