From 0ade9a7dda420f7e50a83977f75f90ab7b488279 Mon Sep 17 00:00:00 2001 From: David Levine Date: Sat, 15 Oct 2016 14:21:13 -0400 Subject: [PATCH] Plugged memory leak in convert_content_charset(). --- uip/mhshowsbr.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index 37fc86f8..093c9776 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -1266,20 +1266,22 @@ convert_content_charset (CT ct, char **file) { /* Using current locale, see if the content needs to be converted. */ /* content_charset() cannot return NULL. */ - char *charset = content_charset (ct); + char *src_charset = content_charset (ct); - if (! check_charset (charset, strlen (charset))) { + if (! check_charset (src_charset, strlen (src_charset))) { int unused = 0; - char *charset = getcpy (get_charset ()); + char *dest_charset = getcpy (get_charset ()); - if (convert_charset (ct, charset, &unused) == 0) { + if (convert_charset (ct, dest_charset, &unused) == 0) { *file = ct->c_cefile.ce_file; } else { status = NOTOK; } + + free (dest_charset); } - free (charset); + free (src_charset); #else /* ! HAVE_ICONV */ NMH_UNUSED (ct); NMH_UNUSED (file); -- 2.56.0