mirror of
https://github.com/xemu-project/xemu.git
synced 2025-02-21 12:53:01 +00:00
ui/clipboard: fix use-after-free regression
The same info may be used to update the clipboard, and may be freed before being ref'ed again. Fixes: 70a54b01693ed ("ui: avoid compiler warnings from unused clipboard info variable") Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20220214115917.1679568-1-marcandre.lureau@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
cb8962c146
commit
02a8ee2e18
@ -66,8 +66,10 @@ void qemu_clipboard_update(QemuClipboardInfo *info)
|
||||
|
||||
notifier_list_notify(&clipboard_notifiers, ¬ify);
|
||||
|
||||
qemu_clipboard_info_unref(cbinfo[info->selection]);
|
||||
cbinfo[info->selection] = qemu_clipboard_info_ref(info);
|
||||
if (cbinfo[info->selection] != info) {
|
||||
qemu_clipboard_info_unref(cbinfo[info->selection]);
|
||||
cbinfo[info->selection] = qemu_clipboard_info_ref(info);
|
||||
}
|
||||
}
|
||||
|
||||
QemuClipboardInfo *qemu_clipboard_info(QemuClipboardSelection selection)
|
||||
|
Loading…
x
Reference in New Issue
Block a user