Fix GHOST/Wayland memory leak when copying text

This commit is contained in:
Campbell Barton 2022-06-09 21:32:49 +10:00
parent 41c7c744eb
commit f37a37cafe
1 changed files with 1 additions and 0 deletions

View File

@ -1615,6 +1615,7 @@ void GHOST_SystemWayland::putClipboard(const char *buffer, bool /*selection*/) c
data_source_t *data_source = d->inputs[0]->data_source;
/* Copy buffer. */
free(data_source->buffer_out);
const size_t buffer_size = strlen(buffer) + 1;
data_source->buffer_out = static_cast<char *>(malloc(buffer_size));
std::memcpy(data_source->buffer_out, buffer, buffer_size);