ges: Fix a bunch of leaks
authorEdward Hervey <edward@centricular.com>
Mon, 27 Nov 2017 10:49:04 +0000 (11:49 +0100)
committerEdward Hervey <bilboed@bilboed.com>
Mon, 27 Nov 2017 10:49:43 +0000 (11:49 +0100)
There are definitely more left, but don't have time for more debugging

ges/ges-asset.c
ges/ges-base-xml-formatter.c
ges/ges-effect-asset.c
ges/ges-effect.c
ges/ges-timeline-element.c
ges/ges-uri-asset.c
ges/ges-xml-formatter.c

index 6ff643c..77a45cf 100644 (file)
@@ -983,6 +983,8 @@ ges_asset_request (GType extractable_type, const gchar * id, GError ** error)
     _unsure_material_for_wrong_id (id, extractable_type, lerr);
     real_id = g_strdup (id);
   }
+  if (lerr)
+    g_error_free (lerr);
 
   asset = ges_asset_cache_lookup (extractable_type, real_id);
   if (asset) {
index ede45c8..908267e 100644 (file)
@@ -486,6 +486,7 @@ _loading_done (GESFormatter * self)
   for (tmp = assets; tmp; tmp = tmp->next) {
     ges_asset_set_proxy (NULL, tmp->data);
   }
+  g_list_free (assets);
 
   g_hash_table_foreach (priv->layers, (GHFunc) _set_auto_transition, NULL);
   ges_project_set_loaded (self->project, self);
index 6ebd1ef..8189c53 100644 (file)
@@ -50,6 +50,7 @@ _fill_track_type (GESAsset * asset)
   if (bin_desc) {
     ges_track_element_asset_set_track_type (GES_TRACK_ELEMENT_ASSET (asset),
         ttype);
+    g_free (bin_desc);
   } else {
     GST_WARNING_OBJECT (asset, "No track type set, you should"
         " specify one in [audio, video] as first component" " in the asset id");
index 66c347f..c1ce166 100644 (file)
@@ -71,6 +71,8 @@ extractable_check_id (GType type, const gchar * id, GError ** error)
   else
     g_assert_not_reached ();
 
+  g_free (bin_desc);
+
   return real_id;
 }
 
index caf7424..da6de4f 100644 (file)
@@ -1316,18 +1316,18 @@ gboolean
 ges_timeline_element_add_child_property (GESTimelineElement * self,
     GParamSpec * pspec, GObject * child)
 {
-  gchar *signame = g_strconcat ("notify::", pspec->name, NULL);
+  gchar *signame;
   ChildPropHandler *handler;
 
   if (g_hash_table_contains (self->priv->children_props, pspec)) {
     GST_INFO_OBJECT (self, "Child property already exists: %s", pspec->name);
-
     return FALSE;
   }
 
   GST_DEBUG_OBJECT (self, "Adding child property: %" GST_PTR_FORMAT "::%s",
       child, pspec->name);
 
+  signame = g_strconcat ("notify::", pspec->name, NULL);
   handler = (ChildPropHandler *) g_slice_new0 (ChildPropHandler);
   handler->child = gst_object_ref (child);
   handler->handler_id =
index 7a27a03..3389878 100644 (file)
@@ -369,12 +369,14 @@ static void
 _set_meta_file_size (const gchar * uri, GESUriClipAsset * asset)
 {
   GError *error = NULL;
-  GFileInfo *file_info;
+  GFileInfo *file_info = NULL;
   guint64 file_size;
+  GFile *gfile = NULL;
 
   GESMetaContainer *container = GES_META_CONTAINER (asset);
 
-  file_info = g_file_query_info (g_file_new_for_uri (uri), "standard::size",
+  gfile = g_file_new_for_uri (uri);
+  file_info = g_file_query_info (gfile, "standard::size",
       G_FILE_QUERY_INFO_NONE, NULL, &error);
   if (!error) {
     file_size = g_file_info_get_attribute_uint64 (file_info, "standard::size");
@@ -383,6 +385,10 @@ _set_meta_file_size (const gchar * uri, GESUriClipAsset * asset)
   } else {
     g_error_free (error);
   }
+  if (gfile)
+    g_object_unref (gfile);
+  if (file_info)
+    g_object_unref (file_info);
 }
 
 static void
index bf2f9c7..ea54b72 100644 (file)
@@ -1256,6 +1256,7 @@ _save_layers (GESXmlFormatter * self, GString * str, GESTimeline * timeline)
 
       priv->nbelements++;
     }
+    g_list_free_full (clips, (GDestroyNotify) gst_object_unref);
     g_string_append (str, "      </layer>\n");
   }
 }
@@ -1318,6 +1319,7 @@ _save_groups (GESXmlFormatter * self, GString * str, GESTimeline * timeline)
   for (tmp = ges_timeline_get_groups (timeline); tmp; tmp = tmp->next) {
     _save_group (self, str, &seen_groups, tmp->data);
   }
+  g_list_free (seen_groups);
   g_string_append (str, "      </groups>\n");
 }