* [PATCH] hmp/vnc: Fix info vnc list leak
@ 2020-03-23 12:08 Dr. David Alan Gilbert (git)
2020-03-24 13:45 ` Peter Maydell
2020-03-24 18:54 ` Dr. David Alan Gilbert
0 siblings, 2 replies; 3+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2020-03-23 12:08 UTC (permalink / raw)
To: qemu-devel, peter.maydell; +Cc: kraxel
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
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>
---
monitor/hmp-cmds.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index a00248527c..1d473e809c 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
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] hmp/vnc: Fix info vnc list leak
2020-03-23 12:08 [PATCH] hmp/vnc: Fix info vnc list leak Dr. David Alan Gilbert (git)
@ 2020-03-24 13:45 ` Peter Maydell
2020-03-24 18:54 ` Dr. David Alan Gilbert
1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2020-03-24 13:45 UTC (permalink / raw)
To: Dr. David Alan Gilbert (git); +Cc: QEMU Developers, Gerd Hoffmann
On Mon, 23 Mar 2020 at 12:08, Dr. David Alan Gilbert (git)
<dgilbert@redhat.com> wrote:
>
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> 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>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] hmp/vnc: Fix info vnc list leak
2020-03-23 12:08 [PATCH] hmp/vnc: Fix info vnc list leak Dr. David Alan Gilbert (git)
2020-03-24 13:45 ` Peter Maydell
@ 2020-03-24 18:54 ` Dr. David Alan Gilbert
1 sibling, 0 replies; 3+ messages in thread
From: Dr. David Alan Gilbert @ 2020-03-24 18:54 UTC (permalink / raw)
To: qemu-devel, peter.maydell; +Cc: kraxel
* Dr. David Alan Gilbert (git) (dgilbert@redhat.com) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> 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>
Queued
> ---
> monitor/hmp-cmds.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
> index a00248527c..1d473e809c 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
> --
> 2.25.1
>
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-24 18:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-23 12:08 [PATCH] hmp/vnc: Fix info vnc list leak Dr. David Alan Gilbert (git)
2020-03-24 13:45 ` Peter Maydell
2020-03-24 18:54 ` Dr. David Alan Gilbert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).