Wayland: Fix double free on data source error

If data source creation fails, the string containing the data for it
would be freed a second time during termination.
This commit is contained in:
Camilla Löwy 2022-03-22 18:55:31 +01:00
parent 9c95cfb9f1
commit b386371f57
2 changed files with 2 additions and 0 deletions

View File

@ -312,6 +312,7 @@ information on what to include when reporting a bug.
- [Wayland] Bugfix: `glfwPostEmptyEvent` sometimes had no effect (#1520,#1521) - [Wayland] Bugfix: `glfwPostEmptyEvent` sometimes had no effect (#1520,#1521)
- [Wayland] Bugfix: `glfwSetClipboardString` would fail if set to result of - [Wayland] Bugfix: `glfwSetClipboardString` would fail if set to result of
`glfwGetClipboardString` `glfwGetClipboardString`
- [Wayland] Bugfix: Data source creation error would cause double free at termination
- [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Removed use of deprecated function `gettimeofday`
- [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled
- [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072)

View File

@ -1683,6 +1683,7 @@ void _glfwSetClipboardStringWayland(const char* string)
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Impossible to create clipboard source"); "Wayland: Impossible to create clipboard source");
_glfw_free(_glfw.wl.clipboardSendString); _glfw_free(_glfw.wl.clipboardSendString);
_glfw.wl.clipboardSendString = NULL;
return; return;
} }
wl_data_source_add_listener(_glfw.wl.dataSource, wl_data_source_add_listener(_glfw.wl.dataSource,