[Qemu-devel] [PATCH] curses ui: add missing iconv_close

Samuel Thibault posted 1 patch 9 weeks ago
Test asan passed
Test docker-clang@ubuntu passed
Test docker-mingw@fedora passed
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190314171804.8471-1-samuel.thibault@ens-lyon.org
Maintainers: Gerd Hoffmann <kraxel@redhat.com>
ui/curses.c | 1 +
1 file changed, 1 insertion(+)

[Qemu-devel] [PATCH] curses ui: add missing iconv_close

Posted by Samuel Thibault 9 weeks ago
The iconv_t is opened but never closed.

Spotted by Coverity: CID 1399708
Spotted by Coverity: CID 1399709
Spotted by Coverity: CID 1399713

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 ui/curses.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ui/curses.c b/ui/curses.c
index 3a7e8649f3..1f83a15a1c 100644
--- a/ui/curses.c
+++ b/ui/curses.c
@@ -646,6 +646,7 @@ static void font_setup(void)
             }
         }
     }
+    iconv_close(ucs_to_wchar_conv);
 }
 
 static void curses_setup(void)
-- 
2.20.1


Re: [Qemu-devel] [PATCH] curses ui: add missing iconv_close

Posted by Peter Maydell 9 weeks ago
On Thu, 14 Mar 2019 at 17:20, Samuel Thibault
<samuel.thibault@ens-lyon.org> wrote:
>
> The iconv_t is opened but never closed.
>
> Spotted by Coverity: CID 1399708
> Spotted by Coverity: CID 1399709
> Spotted by Coverity: CID 1399713
>
> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> ---
>  ui/curses.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/ui/curses.c b/ui/curses.c
> index 3a7e8649f3..1f83a15a1c 100644
> --- a/ui/curses.c
> +++ b/ui/curses.c
> @@ -646,6 +646,7 @@ static void font_setup(void)
>              }
>          }
>      }
> +    iconv_close(ucs_to_wchar_conv);
>  }

Don't you need to iconv_close() font_conv and
wchar_to_ucs_conv as well ?

thanks
-- PMM

Re: [Qemu-devel] [PATCH] curses ui: add missing iconv_close

Posted by Samuel Thibault 9 weeks ago
Peter Maydell, le jeu. 14 mars 2019 17:21:54 +0000, a ecrit:
> On Thu, 14 Mar 2019 at 17:20, Samuel Thibault
> <samuel.thibault@ens-lyon.org> wrote:
> >
> > Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> > ---
> >  ui/curses.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/ui/curses.c b/ui/curses.c
> > index 3a7e8649f3..1f83a15a1c 100644
> > --- a/ui/curses.c
> > +++ b/ui/curses.c
> > @@ -646,6 +646,7 @@ static void font_setup(void)
> >              }
> >          }
> >      }
> > +    iconv_close(ucs_to_wchar_conv);
> >  }
> 
> Don't you need to iconv_close() font_conv and
> wchar_to_ucs_conv as well ?

Right, sorry, since I didn't have coverity access I didn't realize there
were three leaks.

Samuel

Re: [Qemu-devel] [PATCH] curses ui: add missing iconv_close

Posted by Peter Maydell 9 weeks ago
On Thu, 14 Mar 2019 at 17:27, Samuel Thibault <samuel.thibault@gnu.org> wrote:
>
> Peter Maydell, le jeu. 14 mars 2019 17:21:54 +0000, a ecrit:
> > On Thu, 14 Mar 2019 at 17:20, Samuel Thibault
> > <samuel.thibault@ens-lyon.org> wrote:
> > >
> > > Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> > > ---
> > >  ui/curses.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/ui/curses.c b/ui/curses.c
> > > index 3a7e8649f3..1f83a15a1c 100644
> > > --- a/ui/curses.c
> > > +++ b/ui/curses.c
> > > @@ -646,6 +646,7 @@ static void font_setup(void)
> > >              }
> > >          }
> > >      }
> > > +    iconv_close(ucs_to_wchar_conv);
> > >  }
> >
> > Don't you need to iconv_close() font_conv and
> > wchar_to_ucs_conv as well ?
>
> Right, sorry, since I didn't have coverity access I didn't realize there
> were three leaks.

I did mention all 3 variables in my email about the issue :-)

thanks
-- PMM