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: 70a54b0169
("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,9 +66,11 @@ void qemu_clipboard_update(QemuClipboardInfo *info)
|
||||
|
||||
notifier_list_notify(&clipboard_notifiers, ¬ify);
|
||||
|
||||
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…
Reference in New Issue
Block a user