ges: Fix more ges_timeline_get_layers() usage memory leaks
authorEdward Hervey <edward.hervey@collabora.co.uk>
Tue, 11 Jan 2011 17:14:41 +0000 (18:14 +0100)
committerEdward Hervey <edward.hervey@collabora.co.uk>
Tue, 11 Jan 2011 17:14:41 +0000 (18:14 +0100)
ges/ges-formatter.c
ges/ges-keyfile-formatter.c

index d59ada245c6e941f5e39e9af8ba665f7ad5e9fd1..9aff5e5fa9630f87b069c6b8a885e6f345659e58 100644 (file)
@@ -309,9 +309,14 @@ gboolean
 ges_formatter_save (GESFormatter * formatter, GESTimeline * timeline)
 {
   GESFormatterClass *klass;
+  GList *layers;
 
   /* Saving an empty timeline is not allowed */
-  g_return_val_if_fail (ges_timeline_get_layers (timeline) != NULL, FALSE);
+  layers = ges_timeline_get_layers (timeline);
+
+  g_return_val_if_fail (layers != NULL, FALSE);
+  g_list_foreach (layers, (GFunc) g_object_unref, NULL);
+  g_list_free (layers);
 
   klass = GES_FORMATTER_GET_CLASS (formatter);
 
index 943c70c0fda70a118ea4398840b0378529e7e6d7..090fe83450ef61e9bbd3db02cd0c7139c57ced5d 100644 (file)
@@ -177,9 +177,8 @@ save_keyfile (GESFormatter * keyfile_formatter, GESTimeline * timeline)
     g_list_free (objs);
   }
 
-  for (tmp = layers; tmp; tmp = g_list_next (tmp)) {
-    g_object_unref (tmp->data);
-  }
+  g_list_foreach (layers, (GFunc) g_object_unref, NULL);
+  g_list_free (layers);
 
   data = g_key_file_to_data (kf, &length, NULL);
   ges_formatter_set_data (keyfile_formatter, data, length);