mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-01 22:20:12 +01:00
cli: don't leak 'str' returned by g_strdup_vprintf()
This commit is contained in:
parent
7a79a78a1b
commit
fd93fb9fb9
1 changed files with 4 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue