ges: Do not use freed pointers
authorThibault Saunier <tsaunier@gnome.org>
Sat, 10 May 2014 20:52:18 +0000 (22:52 +0200)
committerThibault Saunier <tsaunier@gnome.org>
Sat, 10 May 2014 21:00:45 +0000 (23:00 +0200)
COVERTY CID 1212182
COVERTY CID 1212184
COVERTY CID 1212185

ges/ges-base-xml-formatter.c
tools/ges-launch.c

index 626ba06..04b3513 100644 (file)
@@ -555,9 +555,9 @@ _free_pending_asset (GESBaseXmlFormatterPrivate * priv, PendingAsset * passet)
     g_free (passet->metadatas);
   if (passet->properties)
     gst_structure_free (passet->properties);
-  g_slice_free (PendingAsset, passet);
 
   priv->pending_assets = g_list_remove (priv->pending_assets, passet);
+  g_slice_free (PendingAsset, passet);
 }
 
 static void
index 63f2b66..99d74f4 100644 (file)
@@ -445,9 +445,6 @@ create_pipeline (GESTimeline ** ret_timeline, gchar * load_path,
 
   ges_timeline_commit (timeline);
 
-  if (uri)
-    g_free (uri);
-
   /* save project if path is given. we do this now in case GES crashes or
    * hangs during playback. */
   if (save_path && !load_path) {
@@ -457,7 +454,6 @@ create_pipeline (GESTimeline ** ret_timeline, gchar * load_path,
       goto failure;
     }
     ges_timeline_save_to_uri (timeline, uri, NULL, TRUE, NULL);
-    g_free (uri);
   }
 
   /* In order to view our timeline, let's grab a convenience pipeline to put
@@ -479,17 +475,23 @@ create_pipeline (GESTimeline ** ret_timeline, gchar * load_path,
     goto failure;
 
   *ret_timeline = timeline;
+
+done:
+  if (uri)
+    g_free (uri);
+
   return pipeline;
 
 failure:
   {
-    if (uri)
-      g_free (uri);
     if (timeline)
       gst_object_unref (timeline);
     if (pipeline)
       gst_object_unref (pipeline);
-    return NULL;
+    pipeline = NULL;
+    timeline = NULL;
+
+    goto done;
   }
 }
 
@@ -587,7 +589,6 @@ static GstEncodingProfile *
 _parse_encoding_profile (const gchar * format)
 {
   GstCaps *caps;
-  char *preset_name = NULL;
   GstEncodingProfile *encoding_profile;
   gchar **restriction_format, **preset_v;
 
@@ -610,8 +611,9 @@ _parse_encoding_profile (const gchar * format)
   }
 
   for (i = 1; strcaps_v[i]; i++) {
-    GstEncodingProfile *profile = NULL;
     gchar *strcaps, *strpresence;
+    char *preset_name = NULL;
+    GstEncodingProfile *profile = NULL;
 
     restriction_format = g_strsplit (strcaps_v[i], "->", 0);
     if (restriction_format[1]) {