summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWilliam Jon McCann <jmccann@redhat.com>2009-09-14 15:54:33 -0400
committerWilliam Jon McCann <jmccann@redhat.com>2009-09-14 15:54:33 -0400
commit81435b3d10d4b124c0a6b4649b4cf74378a26323 (patch)
tree3a9b0e5c78cb59ea7a253c0db9e249098b2c3d9f /src
parentb4f893eb294883909759fc9fd825eade1a9f308c (diff)
fix a few small leaks
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=23939
Diffstat (limited to 'src')
-rw-r--r--src/ck-seat.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/ck-seat.c b/src/ck-seat.c
index 4f5e63f..8cf64e3 100644
--- a/src/ck-seat.c
+++ b/src/ck-seat.c
@@ -1119,6 +1119,8 @@ ck_seat_new_from_file (const char *sid,
gsize ndevices;
gsize i;
+ seat = NULL;
+
key_file = g_key_file_new ();
error = NULL;
res = g_key_file_load_from_file (key_file,
@@ -1128,19 +1130,19 @@ ck_seat_new_from_file (const char *sid,
if (! res) {
g_warning ("Unable to load seats from file %s: %s", path, error->message);
g_error_free (error);
- return NULL;
+ goto out;
}
group = g_key_file_get_start_group (key_file);
if (group == NULL || strcmp (group, "Seat Entry") != 0) {
g_warning ("Not a seat file: %s", path);
- return NULL;
+ goto out;
}
hidden = g_key_file_get_boolean (key_file, group, "Hidden", NULL);
if (hidden) {
g_debug ("Seat is hidden");
- return NULL;
+ goto out;
}
device_list = g_key_file_get_string_list (key_file, group, "Devices", &ndevices, NULL);
@@ -1173,13 +1175,16 @@ ck_seat_new_from_file (const char *sid,
g_strfreev (split);
}
-
+ g_strfreev (device_list);
g_free (group);
seat = ck_seat_new_with_devices (sid, CK_SEAT_KIND_STATIC, devices);
-
g_ptr_array_free (devices, TRUE);
+out:
+
+ g_key_file_free (key_file);
+
return seat;
}