[gnome-remote-desktop] settings: Don't leak credentials, when username or password is NULL
- From: Jonas Ã…dahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-remote-desktop] settings: Don't leak credentials, when username or password is NULL
- Date: Fri, 26 Nov 2021 16:12:20 +0000 (UTC)
commit 41d407a1888b84df71476b7e57ffebfce1a3679b
Author: Pascal Nowack <Pascal Nowack gmx de>
Date: Fri Nov 26 15:41:07 2021 +0100
settings: Don't leak credentials, when username or password is NULL
While commit b17d0befe5e6d70466ac9d0110a6247499b92227 fixes a crash,
when the username or password is NULL, it accidentally leaks the string
with the credentials, which is in such case not NULL.
Use the autofree- and autoptr- helpers to get rid of any leaks here.
Fixes: b17d0befe5e6d70466ac9d0110a6247499b92227
src/grd-settings.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
---
diff --git a/src/grd-settings.c b/src/grd-settings.c
index 23b54bd..be4b4d3 100644
--- a/src/grd-settings.c
+++ b/src/grd-settings.c
@@ -138,8 +138,8 @@ grd_settings_get_rdp_username (GrdSettings *settings,
GError **error)
{
const char *test_password_override;
- GVariant *credentials;
- char *credentials_string;
+ g_autofree char *credentials_string = NULL;
+ g_autoptr (GVariant) credentials = NULL;
char *username = NULL;
test_password_override = g_getenv ("GNOME_REMOTE_DESKTOP_TEST_RDP_PASSWORD");
@@ -165,9 +165,6 @@ grd_settings_get_rdp_username (GrdSettings *settings,
return NULL;
}
- g_variant_unref (credentials);
- g_free (credentials_string);
-
return username;
}
@@ -176,8 +173,8 @@ grd_settings_get_rdp_password (GrdSettings *settings,
GError **error)
{
const char *test_password_override;
- GVariant *credentials;
- char *credentials_string;
+ g_autofree char *credentials_string = NULL;
+ g_autoptr (GVariant) credentials = NULL;
char *password = NULL;
test_password_override = g_getenv ("GNOME_REMOTE_DESKTOP_TEST_RDP_PASSWORD");
@@ -203,9 +200,6 @@ grd_settings_get_rdp_password (GrdSettings *settings,
return NULL;
}
- g_variant_unref (credentials);
- g_free (credentials_string);
-
return password;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]