[gnome-desktop/gobject-gnomerr] Disallow null filenames passed to gnome_rr_config_load_filename()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-desktop/gobject-gnomerr] Disallow null filenames passed to gnome_rr_config_load_filename()
- Date: Wed, 5 Jan 2011 22:07:58 +0000 (UTC)
commit 7c2e51427fff29f1582eb5ed035f8c7637ea908f
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Jan 5 16:19:48 2011 -0600
Disallow null filenames passed to gnome_rr_config_load_filename()
This also fixes a leak when the default intended filename was
generated on-the-fly.
Signed-off-by: Federico Mena Quintero <federico gnome org>
libgnome-desktop/gnome-rr-config.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/libgnome-desktop/gnome-rr-config.c b/libgnome-desktop/gnome-rr-config.c
index db50801..f5172d3 100644
--- a/libgnome-desktop/gnome-rr-config.c
+++ b/libgnome-desktop/gnome-rr-config.c
@@ -669,11 +669,9 @@ gnome_rr_config_load_filename (GnomeRRConfig *result, const char *filename, GErr
gboolean found = FALSE;
g_return_val_if_fail (GNOME_IS_RR_CONFIG (result), FALSE);
+ g_return_val_if_fail (filename != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
- if (filename == NULL)
- filename = gnome_rr_config_get_intended_filename ();
-
current = gnome_rr_config_new_current (result->priv->screen, error);
configs = configurations_read_from_file (filename, error);
@@ -746,8 +744,16 @@ GnomeRRConfig *
gnome_rr_config_new_stored (GnomeRRScreen *screen, GError **error)
{
GnomeRRConfig *self = g_object_new (GNOME_TYPE_RR_CONFIG, "screen", screen, NULL);
+ char *filename;
+ gboolean success;
+
+ filename = gnome_rr_config_get_intended_filename ();
+
+ success = gnome_rr_config_load_filename (self, filename, error);
+
+ g_free (filename);
- if (gnome_rr_config_load_filename (self, NULL, error))
+ if (success);
return self;
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]