mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 01:50:08 +01:00
core: fix leak in _config_data_get_main_auth_polkit()
Found by Coverity:
Error: RESOURCE_LEAK (CWE-772):
NetworkManager-1.31.3/src/core/nm-config-data.c:450: alloc_fn: Storage is returned from allocation function "nm_config_data_get_value".
NetworkManager-1.31.3/src/core/nm-config-data.c:450: var_assign: Assigning: "str" = storage returned from "nm_config_data_get_value(self, "main", "auth-polkit", (enum [unnamed type of NMConfigGetValueFlags])6)".
NetworkManager-1.31.3/src/core/nm-config-data.c:454: noescape: Resource "str" is not freed or pointed-to in "nm_auth_polkit_mode_from_string".
NetworkManager-1.31.3/src/core/nm-config-data.c:465: leaked_storage: Variable "str" going out of scope leaks the storage it points to.
# 463| NM_SET_OUT(out_invalid_config, FALSE);
# 464|
# 465|-> return auth_polkit_mode;
# 466| }
# 467|
Fixes: 6d7446e52f ('core: add main.auth-polkit option "root-only"')
This commit is contained in:
parent
dd3aa1224a
commit
ceaa1c369f
1 changed files with 1 additions and 1 deletions
|
|
@ -445,7 +445,7 @@ static NMAuthPolkitMode
|
|||
_config_data_get_main_auth_polkit(const NMConfigData *self, gboolean *out_invalid_config)
|
||||
{
|
||||
NMAuthPolkitMode auth_polkit_mode;
|
||||
const char * str;
|
||||
gs_free char * str = NULL;
|
||||
|
||||
str = nm_config_data_get_value(self,
|
||||
NM_CONFIG_KEYFILE_GROUP_MAIN,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue