From: David Levine Date: Sat, 15 Oct 2016 18:21:13 +0000 (-0400) Subject: Plugged memory leak in convert_content_charset(). X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/0ade9a7dda420f7e50a83977f75f90ab7b488279?hp=6d47af692285e0daaa9eb0fb4432428cca813b46 Plugged memory leak in convert_content_charset(). --- 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);