diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2012-07-10 14:49:35 -0400 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2012-07-11 19:59:52 -0400 |
commit | 079c5ae819e9aba6e75a0b533ed5ff8308038c2d (patch) | |
tree | f52f10332dedc9d01f7d0b32a9f13499652c37e9 /monitor | |
parent | df4069ea879668981dc1984b59e4493f77928fd2 (diff) | |
download | gvfs-079c5ae819e9aba6e75a0b533ed5ff8308038c2d.tar.gz |
udisks2: plug a memory leak
We were not free-ing the UnmountMountsOp structure when there was an
error in one mount. Fix that and use g_list_free_full to make code more
concise.
https://bugzilla.gnome.org/show_bug.cgi?id=676111
Diffstat (limited to 'monitor')
-rw-r--r-- | monitor/udisks2/gvfsudisks2drive.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/monitor/udisks2/gvfsudisks2drive.c b/monitor/udisks2/gvfsudisks2drive.c index 87747ac3..c57931dd 100644 --- a/monitor/udisks2/gvfsudisks2drive.c +++ b/monitor/udisks2/gvfsudisks2drive.c @@ -444,13 +444,10 @@ typedef struct { static void free_unmount_mounts_op (UnmountMountsOp *data) { - GList *l; - for (l = data->pending_mounts; l != NULL; l = l->next) - { - GMount *mount = G_MOUNT (l->data); - g_object_unref (mount); - } - g_list_free (data->pending_mounts); + g_list_free_full (data->pending_mounts, g_object_unref); + + g_object_unref (data->drive); + g_free (data); } static void @@ -470,8 +467,7 @@ unmount_mounts_do (UnmountMountsOp *data) data->user_data, data->on_all_unmounted_data); - g_object_unref (data->drive); - g_free (data); + free_unmount_mounts_op (data); } else { |