diff options
author | Thomas Haller <thaller@redhat.com> | 2021-05-06 21:44:34 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2021-05-11 13:56:50 +0200 |
commit | e5f37477c066233fd8ae3aeaaeeff992ea584d9a (patch) | |
tree | ae96673be14510fad3145a0a8e8b8222fc06334f | |
parent | 61029d406452305ee6a7414dbd264fbc6f535a4b (diff) | |
download | NetworkManager-e5f37477c066233fd8ae3aeaaeeff992ea584d9a.tar.gz |
cli: fix leak in print_wifi_connection()
Found by Coverity:
Error: RESOURCE_LEAK (CWE-772): [#def297] [important]
NetworkManager-1.31.3/src/nmcli/devices.c:4610: alloc_fn: Storage is returned from allocation function "nm_utils_ssid_to_utf8".
NetworkManager-1.31.3/src/nmcli/devices.c:4610: var_assign: Assigning: "ssid" = storage returned from "nm_utils_ssid_to_utf8(g_bytes_get_data(ssid_bytes, NULL), g_bytes_get_size(ssid_bytes))".
NetworkManager-1.31.3/src/nmcli/devices.c:4612: noescape: Resource "ssid" is not freed or pointed-to in "g_print".
NetworkManager-1.31.3/src/nmcli/devices.c:4642: noescape: Resource "ssid" is not freed or pointed-to in "string_append_mecard".
NetworkManager-1.31.3/src/nmcli/devices.c:4654: leaked_storage: Variable "ssid" going out of scope leaks the storage it points to.
# 4652|
# 4653| g_print("\n");
# 4654|-> }
# 4655|
# 4656| static gboolean
Fixes: 7061341a41d5 ('cli: add "nmcli d wifi show"')
-rw-r--r-- | src/nmcli/devices.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nmcli/devices.c b/src/nmcli/devices.c index c165701b3d..9a22e5f775 100644 --- a/src/nmcli/devices.c +++ b/src/nmcli/devices.c @@ -4599,7 +4599,7 @@ print_wifi_connection(const NmcConfig *nmc_config, NMConnection *connection) const char * psk = NULL; const char * type = NULL; GBytes * ssid_bytes; - char * ssid; + gs_free char * ssid = NULL; GString * string; s_wireless = nm_connection_get_setting_wireless(connection); |