diff options
author | Roy Zhang <[email protected]> | 2015-07-28 09:50:34 +0800 |
---|---|---|
committer | Roy Zhang <[email protected]> | 2015-07-28 09:50:34 +0800 |
commit | 3d918b3fadf345acfbaa7fa7af1311b00b519399 (patch) | |
tree | 565a2ec9025de5f85f6878209cfbbcafe29df24a | |
parent | 56aea45e0a777c9c979dbc47b823e47a00ffb8ad (diff) | |
download | mate-power-manager-3d918b3fadf345acfbaa7fa7af1311b00b519399.tar.bz2 mate-power-manager-3d918b3fadf345acfbaa7fa7af1311b00b519399.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.c | 3 |
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); |