Free converted file paths in Xdnd proxy

This commit is contained in:
Robbert van der Helm
2022-08-31 18:16:11 +02:00
parent f671c28edb
commit d289f6f8cf
2 changed files with 13 additions and 2 deletions
+5
View File
@@ -8,6 +8,11 @@ Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased] ## [Unreleased]
### Fixed
- Fixed a minor memory leak in the Wine->X11 drag-and-drop implementation when
converting Windows file paths.
### yabridgectl ### yabridgectl
- Added support for setting up CLAP plugins. - Added support for setting up CLAP plugins.
+8 -2
View File
@@ -847,7 +847,7 @@ void CALLBACK dnd_winevent_callback(HWINEVENTHOOK /*hWinEventHook*/,
// Normalize the paths to something a bit more // Normalize the paths to something a bit more
// friendly // friendly
const char* unix_path = char* unix_path =
wine_get_unix_file_name(file_name.data()); wine_get_unix_file_name(file_name.data());
if (unix_path) { if (unix_path) {
std::error_code err; std::error_code err;
@@ -860,6 +860,10 @@ void CALLBACK dnd_winevent_callback(HWINEVENTHOOK /*hWinEventHook*/,
dragged_files.emplace_back( dragged_files.emplace_back(
cannonical_path); 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; } break;
case TYMED_FILE: { case TYMED_FILE: {
const char* unix_path = char* unix_path =
wine_get_unix_file_name(storage.lpszFileName); wine_get_unix_file_name(storage.lpszFileName);
if (unix_path) { if (unix_path) {
std::error_code err; std::error_code err;
@@ -884,6 +888,8 @@ void CALLBACK dnd_winevent_callback(HWINEVENTHOOK /*hWinEventHook*/,
} else { } else {
dragged_files.emplace_back(cannonical_path); dragged_files.emplace_back(cannonical_path);
} }
HeapFree(GetProcessHeap(), 0, unix_path);
} }
} break; } break;
default: { default: {