[Bf-blender-cvs] [f37a37cafeb] master: Fix GHOST/Wayland memory leak when copying text

Campbell Barton noreply at git.blender.org
Thu Jun 9 13:34:12 CEST 2022


Commit: f37a37cafebd1e48685fbb159c15e828264c28db
Author: Campbell Barton
Date:   Thu Jun 9 21:32:49 2022 +1000
Branches: master
https://developer.blender.org/rBf37a37cafebd1e48685fbb159c15e828264c28db

Fix GHOST/Wayland memory leak when copying text

===================================================================

M	intern/ghost/intern/GHOST_SystemWayland.cpp

===================================================================

diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 816c5f9c614..a5789a2526f 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -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);



More information about the Bf-blender-cvs mailing list