summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Zhang <[email protected]>2015-07-28 09:50:34 +0800
committermonsta <[email protected]>2015-09-01 12:10:00 +0300
commitce00effcd00b290ce37ffda1087f9bc5ec0cf1ae (patch)
tree9863e4816784b293f75b8f5101d6f5fae59306cc
parent02b70065e32f12ddd92d21ef668dc878b272c81f (diff)
downloadmate-power-manager-ce00effcd00b290ce37ffda1087f9bc5ec0cf1ae.tar.bz2
mate-power-manager-ce00effcd00b290ce37ffda1087f9bc5ec0cf1ae.tar.xz
Fix memory leaks
g_variant_get() uses g_strdup() internally, so we should free the string after use.
-rw-r--r--src/gpm-prefs-core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gpm-prefs-core.c b/src/gpm-prefs-core.c
index ddb1bd7..8f1cab8 100644
--- a/src/gpm-prefs-core.c
+++ b/src/gpm-prefs-core.c
@@ -714,6 +714,7 @@ gpm_prefs_init (GpmPrefs *prefs)
if (error == NULL && res != NULL) {
g_variant_get(res,"(s)", &r);
prefs->priv->can_shutdown = g_strcmp0(r,"yes")==0?TRUE:FALSE;
+ g_free(r);
g_variant_unref (res);
} else if (error != NULL ) {
egg_error ("Error in dbus - %s", error->message);
@@ -730,6 +731,7 @@ gpm_prefs_init (GpmPrefs *prefs)
if (error == NULL && res != NULL) {
g_variant_get(res,"(s)", &r);
prefs->priv->can_suspend = g_strcmp0(r,"yes")==0?TRUE:FALSE;
+ g_free(r);
g_variant_unref (res);
} else if (error != NULL ) {
egg_error ("Error in dbus - %s", error->message);
@@ -746,6 +748,7 @@ gpm_prefs_init (GpmPrefs *prefs)
if (error == NULL && res != NULL) {
g_variant_get(res,"(s)", &r);
prefs->priv->can_hibernate = g_strcmp0(r,"yes")==0?TRUE:FALSE;
+ g_free(r);
g_variant_unref (res);
} else if (error != NULL ) {
egg_error ("Error in dbus - %s", error->message);