mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-06 12:38:10 +02:00
cli: fix leaking "value" string in ask_option()
Fixes: c5324ed285 ('nmcli: streamline connection addition')
This commit is contained in:
parent
5dc07174d3
commit
ea3e61047f
1 changed files with 5 additions and 3 deletions
|
|
@ -5594,8 +5594,8 @@ next:
|
||||||
static void
|
static void
|
||||||
ask_option(NmCli *nmc, NMConnection *connection, const NMMetaAbstractInfo *abstract_info)
|
ask_option(NmCli *nmc, NMConnection *connection, const NMMetaAbstractInfo *abstract_info)
|
||||||
{
|
{
|
||||||
char *value;
|
gs_free char *value = NULL;
|
||||||
GError *error = NULL;
|
gs_free_error GError *error = NULL;
|
||||||
gs_free char *prompt = NULL;
|
gs_free char *prompt = NULL;
|
||||||
gboolean multi;
|
gboolean multi;
|
||||||
const char *setting_name, *property_name;
|
const char *setting_name, *property_name;
|
||||||
|
|
@ -5631,11 +5631,13 @@ ask_option(NmCli *nmc, NMConnection *connection, const NMMetaAbstractInfo *abstr
|
||||||
g_print(_("You can specify this option more than once. Press <Enter> when you're done.\n"));
|
g_print(_("You can specify this option more than once. Press <Enter> when you're done.\n"));
|
||||||
|
|
||||||
again:
|
again:
|
||||||
|
nm_clear_g_free(&value);
|
||||||
|
g_clear_error(&error);
|
||||||
|
|
||||||
value = nmc_readline(&nmc->nmc_config, "%s", prompt);
|
value = nmc_readline(&nmc->nmc_config, "%s", prompt);
|
||||||
|
|
||||||
if (!set_option(nmc, connection, abstract_info, value, FALSE, &error)) {
|
if (!set_option(nmc, connection, abstract_info, value, FALSE, &error)) {
|
||||||
g_printerr("%s\n", error->message);
|
g_printerr("%s\n", error->message);
|
||||||
g_clear_error(&error);
|
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue