mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-02 18:58:09 +02:00
cli: fix leak in add_vpn_secrets()
No need to copy @tmp variable, it was leaked.
This commit is contained in:
parent
3d4d1bedda
commit
29dbc21c30
1 changed files with 7 additions and 7 deletions
|
|
@ -399,20 +399,20 @@ add_vpn_secrets (NMSecretAgentSimpleRequest *request,
|
|||
{
|
||||
NMSettingVpn *s_vpn = nm_connection_get_setting_vpn (request->connection);
|
||||
const VpnPasswordName *secret_names, *p;
|
||||
char *tmp = NULL;
|
||||
const char *vpn_msg = NULL;
|
||||
char **iter;
|
||||
|
||||
/* If hints are given, then always ask for what the hints require */
|
||||
if (request->hints && g_strv_length (request->hints)) {
|
||||
for (iter = request->hints; iter && *iter; iter++) {
|
||||
if (!tmp && g_str_has_prefix (*iter, VPN_MSG_TAG))
|
||||
tmp = g_strdup (*iter + strlen (VPN_MSG_TAG));
|
||||
if (request->hints) {
|
||||
for (iter = request->hints; *iter; iter++) {
|
||||
if (!vpn_msg && g_str_has_prefix (*iter, VPN_MSG_TAG))
|
||||
vpn_msg = &(*iter)[NM_STRLEN (VPN_MSG_TAG)];
|
||||
else
|
||||
add_vpn_secret_helper (secrets, s_vpn, *iter, *iter);
|
||||
}
|
||||
}
|
||||
if (msg)
|
||||
*msg = g_strdup (tmp);
|
||||
|
||||
NM_SET_OUT (msg, g_strdup (vpn_msg));
|
||||
|
||||
/* Now add what client thinks might be required, because hints may be empty or incomplete */
|
||||
p = secret_names = nm_vpn_get_secret_names (nm_setting_vpn_get_service_type (s_vpn));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue