This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] libio: Fix gconv-related memory leak [BZ #24583]


On Mai 20 2019, Florian Weimer <fweimer@redhat.com> wrote:

> diff --git a/wcsmbs/wcsmbsload.c b/wcsmbs/wcsmbsload.c
> index 5494d0a23e..cff7ca85f9 100644
> --- a/wcsmbs/wcsmbsload.c
> +++ b/wcsmbs/wcsmbsload.c
> @@ -265,3 +265,17 @@ _nl_cleanup_ctype (struct __locale_data *locale)
>        free ((char *) data);
>      }
>  }
> +
> +/* Free the specified conversion functions (but not CONV itself).  */
> +void
> +__wcsmbs_close_conv (struct gconv_fcts *conv)
> +{
> +  /* Nothing to do if both conversions are statically allocated.  */
> +  if (conv->towc == &to_wc && conv->tomb == &to_mb)
> +    return;

That looks redundant.

> +
> +  if (conv->towc != &to_wc)
> +      __gconv_close_transform (conv->towc, conv->towc_nsteps);
> +  if (conv->tomb != &to_mb)
> +      __gconv_close_transform (conv->tomb, conv->tomb_nsteps);
> +}

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]