aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/window/window.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/window/window.c b/src/window/window.c
index b4443e2..a7c9a71 100644
--- a/src/window/window.c
+++ b/src/window/window.c
@@ -1039,7 +1039,12 @@ bool mgl_window_get_clipboard_string(mgl_window *self, char **str, size_t *size)
ClipboardStringCallbackData callback_data;
callback_data.str = str;
callback_data.size = size;
- return mgl_window_get_clipboard(self, clipboard_copy_string_callback, &callback_data);
+ const bool success = mgl_window_get_clipboard(self, clipboard_copy_string_callback, &callback_data);
+ if(!success) {
+ free(*str);
+ *size = 0;
+ }
+ return success;
}
void mgl_window_set_key_repeat_enabled(mgl_window *self, bool enabled) {