(mc_config_normalize_before_save): fixed possible memory leak.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2011-12-06 10:19:11 +03:00 committed by Slava Zanko
parent d412b1ec8f
commit b49c165c59
1 changed files with 5 additions and 2 deletions

View File

@ -43,6 +43,7 @@ mc_config_normalize_before_save (const gchar * value)
{
GIConv conv;
GString *buffer;
gboolean ok;
if (mc_global.utf8_display)
return g_strdup (value);
@ -53,13 +54,15 @@ mc_config_normalize_before_save (const gchar * value)
buffer = g_string_new ("");
if (str_convert (conv, value, buffer) == ESTR_FAILURE)
ok = (str_convert (conv, value, buffer) != ESTR_FAILURE);
str_close_conv (conv);
if (!ok)
{
g_string_free (buffer, TRUE);
return g_strdup (value);
}
str_close_conv (conv);
return g_string_free (buffer, FALSE);
}