(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

View File

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