qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block/vvfat: Fix memleaks in vvfat_close()
@ 2022-02-07 11:37 Hanna Reitz
  2022-02-07 15:20 ` Philippe Mathieu-Daudé via
  0 siblings, 1 reply; 3+ messages in thread
From: Hanna Reitz @ 2022-02-07 11:37 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Hanna Reitz, qemu-devel

qcow_filename and used_clusters are allocated in enable_write_target(),
but freed only in the error path of vvfat_open().  Free them in
vvfat_close(), too.

Signed-off-by: Hanna Reitz <hreitz@redhat.com>
---
 block/vvfat.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/block/vvfat.c b/block/vvfat.c
index b2b58d93b8..811ba76e30 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -3213,6 +3213,8 @@ static void vvfat_close(BlockDriverState *bs)
     array_free(&(s->directory));
     array_free(&(s->mapping));
     g_free(s->cluster_buffer);
+    g_free(s->qcow_filename);
+    g_free(s->used_clusters);
 
     if (s->qcow) {
         migrate_del_blocker(s->migration_blocker);
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] block/vvfat: Fix memleaks in vvfat_close()
  2022-02-07 11:37 [PATCH] block/vvfat: Fix memleaks in vvfat_close() Hanna Reitz
@ 2022-02-07 15:20 ` Philippe Mathieu-Daudé via
  2022-02-07 16:36   ` Kevin Wolf
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Mathieu-Daudé via @ 2022-02-07 15:20 UTC (permalink / raw)
  To: Hanna Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel

On 7/2/22 12:37, Hanna Reitz wrote:
> qcow_filename and used_clusters are allocated in enable_write_target(),
> but freed only in the error path of vvfat_open().  Free them in
> vvfat_close(), too.
> 
> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
> ---
>   block/vvfat.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/block/vvfat.c b/block/vvfat.c
> index b2b58d93b8..811ba76e30 100644
> --- a/block/vvfat.c
> +++ b/block/vvfat.c
> @@ -3213,6 +3213,8 @@ static void vvfat_close(BlockDriverState *bs)
>       array_free(&(s->directory));
>       array_free(&(s->mapping));
>       g_free(s->cluster_buffer);
> +    g_free(s->qcow_filename);
> +    g_free(s->used_clusters);

Previously posted / reviewed :)

https://lore.kernel.org/qemu-devel/20210430162519.271607-2-philmd@redhat.com/
https://lore.kernel.org/qemu-devel/20210430162519.271607-3-philmd@redhat.com/


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] block/vvfat: Fix memleaks in vvfat_close()
  2022-02-07 15:20 ` Philippe Mathieu-Daudé via
@ 2022-02-07 16:36   ` Kevin Wolf
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2022-02-07 16:36 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: Hanna Reitz, qemu-devel, qemu-block

Am 07.02.2022 um 16:20 hat Philippe Mathieu-Daudé geschrieben:
> On 7/2/22 12:37, Hanna Reitz wrote:
> > qcow_filename and used_clusters are allocated in enable_write_target(),
> > but freed only in the error path of vvfat_open().  Free them in
> > vvfat_close(), too.
> > 
> > Signed-off-by: Hanna Reitz <hreitz@redhat.com>
> > ---
> >   block/vvfat.c | 2 ++
> >   1 file changed, 2 insertions(+)
> > 
> > diff --git a/block/vvfat.c b/block/vvfat.c
> > index b2b58d93b8..811ba76e30 100644
> > --- a/block/vvfat.c
> > +++ b/block/vvfat.c
> > @@ -3213,6 +3213,8 @@ static void vvfat_close(BlockDriverState *bs)
> >       array_free(&(s->directory));
> >       array_free(&(s->mapping));
> >       g_free(s->cluster_buffer);
> > +    g_free(s->qcow_filename);
> > +    g_free(s->used_clusters);
> 
> Previously posted / reviewed :)
> 
> https://lore.kernel.org/qemu-devel/20210430162519.271607-2-philmd@redhat.com/
> https://lore.kernel.org/qemu-devel/20210430162519.271607-3-philmd@redhat.com/

Looks like there were questions about patch 3 and even an objection to
patch 4. Do you suggest we apply only the first two patches? I think at
the time I expected you would either reply or send a v2.

Kevin



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-07 16:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-07 11:37 [PATCH] block/vvfat: Fix memleaks in vvfat_close() Hanna Reitz
2022-02-07 15:20 ` Philippe Mathieu-Daudé via
2022-02-07 16:36   ` Kevin Wolf

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).