Skip to content

Commit

Permalink
hmp/vnc: Fix info vnc list leak
Browse files Browse the repository at this point in the history
We're iterating the list, and then freeing the iteration pointer rather
than the list head.

Fixes: 0a9667e ("hmp: Update info vnc")
Reported-by: Coverity (CID 1421932)
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
  • Loading branch information
dagrh committed Mar 25, 2020
1 parent 6d1da86 commit d4ff109
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions monitor/hmp-cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d4ff109

Please sign in to comment.