aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2021-08-05 17:56:58 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2021-08-31 17:25:09 +0400
commit248c50b2bd31ab7bb8220cd1d7eca3a0d6463aa7 (patch)
tree8fc69995a22b33ddd0ad42efb097c5006e3b8c01 /ui
parentad22d0583300df420819e6c89b1c022b998fac8a (diff)
ui/vdagent: fix leak on error path
"info" was leaked when more than 10 entries. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20210805135715.857938-2-marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/vdagent.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/ui/vdagent.c b/ui/vdagent.c
index a253a8fe63..f6ef8d1993 100644
--- a/ui/vdagent.c
+++ b/ui/vdagent.c
@@ -438,7 +438,7 @@ static void vdagent_chr_recv_clipboard(VDAgentChardev *vd, VDAgentMessage *msg)
uint8_t s = VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD;
uint32_t size = msg->size;
void *data = msg->data;
- QemuClipboardInfo *info;
+ g_autoptr(QemuClipboardInfo) info = NULL;
QemuClipboardType type;
if (have_selection(vd)) {
@@ -477,7 +477,6 @@ static void vdagent_chr_recv_clipboard(VDAgentChardev *vd, VDAgentMessage *msg)
size -= sizeof(uint32_t);
}
qemu_clipboard_update(info);
- qemu_clipboard_info_unref(info);
break;
case VD_AGENT_CLIPBOARD_REQUEST:
if (size < sizeof(uint32_t)) {
@@ -523,7 +522,6 @@ static void vdagent_chr_recv_clipboard(VDAgentChardev *vd, VDAgentMessage *msg)
/* set empty clipboard info */
info = qemu_clipboard_info_new(NULL, s);
qemu_clipboard_update(info);
- qemu_clipboard_info_unref(info);
}
break;
}