aboutsummaryrefslogtreecommitdiff
path: root/monitor
diff options
context:
space:
mode:
authorDr. David Alan Gilbert <dgilbert@redhat.com>2020-03-23 12:08:22 +0000
committerDr. David Alan Gilbert <dgilbert@redhat.com>2020-03-25 12:31:38 +0000
commitd4ff109373ce871928c7e9ef648973eba642b484 (patch)
treef592d9f7cdae2a04433496792d38b788a20282a9 /monitor
parent6d1da867e65f72b890e736a36cbaa9146a824b64 (diff)
downloadqemu-d4ff109373ce871928c7e9ef648973eba642b484.zip
qemu-d4ff109373ce871928c7e9ef648973eba642b484.tar.gz
qemu-d4ff109373ce871928c7e9ef648973eba642b484.tar.bz2
hmp/vnc: Fix info vnc list leak
We're iterating the list, and then freeing the iteration pointer rather than the list head. Fixes: 0a9667ecdb6d ("hmp: Update info vnc") Reported-by: Coverity (CID 1421932) Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <20200323120822.51266-1-dgilbert@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'monitor')
-rw-r--r--monitor/hmp-cmds.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index 76725c2..04ca342 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -527,10 +527,11 @@ static void hmp_info_vnc_servers(Monitor *mon, VncServerInfo2List *server)
void hmp_info_vnc(Monitor *mon, const QDict *qdict)
{
- VncInfo2List *info2l;
+ VncInfo2List *info2l, *info2l_head;
Error *err = NULL;
info2l = qmp_query_vnc_servers(&err);
+ info2l_head = info2l;
if (err) {
hmp_handle_error(mon, err);
return;
@@ -559,7 +560,7 @@ void hmp_info_vnc(Monitor *mon, const QDict *qdict)
info2l = info2l->next;
}
- qapi_free_VncInfo2List(info2l);
+ qapi_free_VncInfo2List(info2l_head);
}
#endif