summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2015-09-17 08:03:10 -0400
committerRay Strode <rstrode@redhat.com>2015-09-21 15:56:10 -0400
commita50a182ef66c58896ba6d8a5d393fb898ece2bbf (patch)
treeeb248594f59144f551db09f79d95e05bd7649d87
parente5c28ee81c91d659e592de55e0fc42e8e936d128 (diff)
downloadgnome-session-a50a182ef66c58896ba6d8a5d393fb898ece2bbf.tar.gz
gsm-util: fix leak in new gsm_util_save_environment function
gsm_util_save_environment calls g_get_environ() without calling g_strfreev() on the result. This commit addresses the problem by using the environ external variable, directly, instead, and avoiding the allocation altogether. https://bugzilla.gnome.org/show_bug.cgi?id=738205
-rw-r--r--gnome-session/gsm-util.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gnome-session/gsm-util.c b/gnome-session/gsm-util.c
index bca1b383..52774e7a 100644
--- a/gnome-session/gsm-util.c
+++ b/gnome-session/gsm-util.c
@@ -32,6 +32,8 @@
#include "gsm-util.h"
+extern char **environ;
+
static gchar *_saved_session_dir = NULL;
char *
@@ -467,7 +469,7 @@ gsm_util_save_environment (void)
return;
}
- environment = g_variant_new_bytestring_array ((const gchar * const *) g_get_environ (), -1);
+ environment = g_variant_new_bytestring_array ((const gchar * const *) environ, -1);
size = g_variant_get_size (environment);
environment_data = g_variant_get_data (environment);