Message ID | 20210511171648.360163-1-siddhesh@sourceware.org |
---|---|
State | New |
Headers | show |
Series | charmap_conversion: Free conversion table on exit | expand |
Ping! I'll push this one too in a couple of days if there are no objections since it is a pretty trivial fix. Siddhesh On 5/11/21 10:46 PM, Siddhesh Poyarekar via Libc-alpha wrote: > The conversion table is allocated using xcalloc but never freed. > --- > iconv/iconv_charmap.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/iconv/iconv_charmap.c b/iconv/iconv_charmap.c > index f76b3ce2b1..e3d12b04e3 100644 > --- a/iconv/iconv_charmap.c > +++ b/iconv/iconv_charmap.c > @@ -228,6 +228,7 @@ charmap_conversion (const char *from_code, struct charmap_t *from_charmap, > while (++remaining < argc); > > /* All done. */ > + free (cvtbl); > return status; > } > >
On 11/05/2021 14:16, Siddhesh Poyarekar via Libc-alpha wrote: > The conversion table is allocated using xcalloc but never freed. LGTM, although I would wrap it on a free_table since it is allocated on both use_from_charmap and use_both_charmaps with allocate_table. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> > --- > iconv/iconv_charmap.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/iconv/iconv_charmap.c b/iconv/iconv_charmap.c > index f76b3ce2b1..e3d12b04e3 100644 > --- a/iconv/iconv_charmap.c > +++ b/iconv/iconv_charmap.c > @@ -228,6 +228,7 @@ charmap_conversion (const char *from_code, struct charmap_t *from_charmap, > while (++remaining < argc); > > /* All done. */ > + free (cvtbl); > return status; > }
On 5/17/21 10:32 PM, Adhemerval Zanella via Libc-alpha wrote: > > > On 11/05/2021 14:16, Siddhesh Poyarekar via Libc-alpha wrote: >> The conversion table is allocated using xcalloc but never freed. > > LGTM, although I would wrap it on a free_table since it is allocated > on both use_from_charmap and use_both_charmaps with allocate_table. OK, I've made this change. I'll post the committed patch shortly. Thanks, Siddhesh
diff --git a/iconv/iconv_charmap.c b/iconv/iconv_charmap.c index f76b3ce2b1..e3d12b04e3 100644 --- a/iconv/iconv_charmap.c +++ b/iconv/iconv_charmap.c @@ -228,6 +228,7 @@ charmap_conversion (const char *from_code, struct charmap_t *from_charmap, while (++remaining < argc); /* All done. */ + free (cvtbl); return status; }