[gnome-session] gsm-util: fix leak in new gsm_util_save_environment function
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session] gsm-util: fix leak in new gsm_util_save_environment function
- Date: Mon, 21 Sep 2015 19:56:45 +0000 (UTC)
commit a50a182ef66c58896ba6d8a5d393fb898ece2bbf
Author: Ray Strode <rstrode redhat com>
Date: Thu Sep 17 08:03:10 2015 -0400
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
gnome-session/gsm-util.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/gnome-session/gsm-util.c b/gnome-session/gsm-util.c
index bca1b38..52774e7 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]