mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 04:18:07 +02:00
config: cleanup ownership handling of @keyfile in read_entire_config()
This commit is contained in:
parent
f8c4a33f25
commit
b5aec6b7e7
1 changed files with 6 additions and 14 deletions
|
|
@ -953,7 +953,7 @@ read_entire_config (const NMConfigCmdLineOptions *cli,
|
||||||
char **out_config_description,
|
char **out_config_description,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GKeyFile *keyfile;
|
gs_unref_keyfile GKeyFile *keyfile = NULL;
|
||||||
gs_unref_ptrarray GPtrArray *system_confs = NULL;
|
gs_unref_ptrarray GPtrArray *system_confs = NULL;
|
||||||
gs_unref_ptrarray GPtrArray *confs = NULL;
|
gs_unref_ptrarray GPtrArray *confs = NULL;
|
||||||
gs_unref_ptrarray GPtrArray *run_confs = NULL;
|
gs_unref_ptrarray GPtrArray *run_confs = NULL;
|
||||||
|
|
@ -983,10 +983,8 @@ read_entire_config (const NMConfigCmdLineOptions *cli,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!read_config (keyfile, FALSE, system_config_dir, filename, error)) {
|
if (!read_config (keyfile, FALSE, system_config_dir, filename, error))
|
||||||
g_key_file_free (keyfile);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -999,26 +997,20 @@ read_entire_config (const NMConfigCmdLineOptions *cli,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!read_config (keyfile, FALSE, RUN_CONFIG_DIR, filename, error)) {
|
if (!read_config (keyfile, FALSE, RUN_CONFIG_DIR, filename, error))
|
||||||
g_key_file_free (keyfile);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* First read the base config file */
|
/* First read the base config file */
|
||||||
if (!read_base_config (keyfile, cli ? cli->config_main_file : NULL, &o_config_main_file, error)) {
|
if (!read_base_config (keyfile, cli ? cli->config_main_file : NULL, &o_config_main_file, error))
|
||||||
g_key_file_free (keyfile);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
g_assert (o_config_main_file);
|
g_assert (o_config_main_file);
|
||||||
|
|
||||||
for (i = 0; i < confs->len; i++) {
|
for (i = 0; i < confs->len; i++) {
|
||||||
if (!read_config (keyfile, FALSE, config_dir, confs->pdata[i], error)) {
|
if (!read_config (keyfile, FALSE, config_dir, confs->pdata[i], error))
|
||||||
g_key_file_free (keyfile);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Merge settings from command line. They overwrite everything read from
|
/* Merge settings from command line. They overwrite everything read from
|
||||||
|
|
@ -1047,7 +1039,7 @@ read_entire_config (const NMConfigCmdLineOptions *cli,
|
||||||
*out_config_description = g_string_free (str, FALSE);
|
*out_config_description = g_string_free (str, FALSE);
|
||||||
}
|
}
|
||||||
NM_SET_OUT (out_config_main_file, g_steal_pointer (&o_config_main_file));
|
NM_SET_OUT (out_config_main_file, g_steal_pointer (&o_config_main_file));
|
||||||
return keyfile;
|
return g_steal_pointer (&keyfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue