bin: Fix minor race when adding to a bin
[platform/upstream/gstreamer.git] / gst / gsttracerrecord.c
index 00102bd..639a4cc 100644 (file)
@@ -178,7 +178,7 @@ gst_tracer_record_init (GstTracerRecord * self)
  *
  * > Please note that this is still under discussion and subject to change.
  *
- * Returns: a new #GstTracerRecord
+ * Returns: (transfer full): a new #GstTracerRecord
  */
 GstTracerRecord *
 gst_tracer_record_new (const gchar * name, const gchar * firstfield, ...)
@@ -208,6 +208,7 @@ gst_tracer_record_new (const gchar * name, const gchar * firstfield, ...)
     G_VALUE_COLLECT_INIT (&val, type, varargs, G_VALUE_NOCOPY_CONTENTS, &err);
     if (G_UNLIKELY (err)) {
       g_critical ("%s", err);
+      g_free (err);
       break;
     }
     /* see boxed_proxy_collect_value */
@@ -218,7 +219,11 @@ gst_tracer_record_new (const gchar * name, const gchar * firstfield, ...)
   }
   va_end (varargs);
 
-  self = g_object_newv (GST_TYPE_TRACER_RECORD, 0, NULL);
+  self = g_object_new (GST_TYPE_TRACER_RECORD, NULL);
+
+  /* Clear floating flag */
+  gst_object_ref_sink (self);
+
   self->spec = structure;
   gst_tracer_record_build_format (self);