From 082ae508a0640ab7bf68f89fb6786653def6ef2c Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Mon, 4 Mar 2019 14:29:30 +0100 Subject: [PATCH] clients: fix keyfile string memory leak The return value of g_key_file_get_string() was leaked. Fixes: 5a0d67f739052512297af8e21273af4a7b355213 --- clients/common/nm-secret-agent-simple.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/clients/common/nm-secret-agent-simple.c b/clients/common/nm-secret-agent-simple.c index 18be0c6735..59e4c5a7b5 100644 --- a/clients/common/nm-secret-agent-simple.c +++ b/clients/common/nm-secret-agent-simple.c @@ -600,12 +600,15 @@ _auth_dialog_exited (GPid pid, int status, gpointer user_data) goto out; for (i = 1; groups[i]; i++) { + gs_free char *pretty_name = NULL; + if (!g_key_file_get_boolean (keyfile, groups[i], "IsSecret", NULL)) continue; if (!g_key_file_get_boolean (keyfile, groups[i], "ShouldAsk", NULL)) continue; - g_ptr_array_add (secrets, _secret_real_new_vpn_secret (g_key_file_get_string (keyfile, groups[i], "Label", NULL), + pretty_name = g_key_file_get_string (keyfile, groups[i], "Label", NULL); + g_ptr_array_add (secrets, _secret_real_new_vpn_secret (pretty_name, NM_SETTING (s_vpn), groups[i], nm_setting_vpn_get_service_type (s_vpn)));