mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
(mc_config_normalize_before_save): fixed possible memory leak.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
d412b1ec8f
commit
b49c165c59
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user