mxfdemux: fix memory leak
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 26 Mar 2015 10:52:33 +0000 (11:52 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 4 Apr 2015 18:47:40 +0000 (19:47 +0100)
Reset the internal segment before freeing it.

mxf_index_table_segment_parse() allocates data inside the segment
(like segment->delta_entries) which have to be freed using
mxf_index_table_segment_reset().

https://bugzilla.gnome.org/show_bug.cgi?id=746803

gst/mxf/mxfdemux.c

index 18453da..e45e49c 100644 (file)
@@ -2048,11 +2048,13 @@ gst_mxf_demux_handle_index_table_segment (GstMXFDemux * demux,
       (GCompareFunc) compare_index_table_segments);
 
   /* Prevent duplicates */
-  if (l == NULL)
+  if (l == NULL) {
     demux->pending_index_table_segments =
         g_list_prepend (demux->pending_index_table_segments, segment);
-  else
+  } else {
+    mxf_index_table_segment_reset (segment);
     g_free (segment);
+  }
 
   return GST_FLOW_OK;
 }