Ticket #1942: MC crashes on exit when using C locale.

Starting mc with:
LANG=C mc
cases a crash when mc exits. No other LC_* variable was set.

The issue is in src/strutil.c module. With C locale, str_init_strings()
fails to set str_cnv_not_convert variable leaving it with value -1
(INVALID_CONV). str_uninit_strings() passes str_cnv_not_convert blindly
to g_iconv_close() which tries to dereference it.

This commit adds a check to str_uninit_strings() if str_cnv_not_convert
value is valid.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Milan Cermak 2010-01-06 18:33:42 +03:00 committed by Slava Zanko
parent 822a7fa624
commit 43bb84d66d
1 changed files with 2 additions and 1 deletions

View File

@ -404,7 +404,8 @@ str_init_strings (const char *termenc)
void void
str_uninit_strings (void) str_uninit_strings (void)
{ {
g_iconv_close (str_cnv_not_convert); if (str_cnv_not_convert != INVALID_CONV)
g_iconv_close (str_cnv_not_convert);
g_free (codeset); g_free (codeset);
} }