cli: don't leak 'str' returned by g_strdup_vprintf()

This commit is contained in:
Jiří Klimeš 2014-06-04 08:55:35 +02:00
parent 7a79a78a1b
commit fd93fb9fb9

View file

@ -309,7 +309,7 @@ char *
nmc_colorize (NmcTermColor color, const char *fmt, ...)
{
va_list args;
char *str;
char *str, *colored;
const char *ansi_color, *color_end;
va_start (args, fmt);
@ -322,7 +322,9 @@ nmc_colorize (NmcTermColor color, const char *fmt, ...)
else
color_end = "";
return g_strdup_printf ("%s%s%s", ansi_color, str, color_end);
colored = g_strdup_printf ("%s%s%s", ansi_color, str, color_end);
g_free (str);
return colored;
}
/*