Commit f99fe474 authored by Thiago Santos's avatar Thiago Santos

mpegts: sections: prevent assertion when packet parsing fails

the descriptors entry can be left as NULL and freeing the structure
will fail (assertion happens)
parent bd34e628
......@@ -49,7 +49,8 @@ _gst_mpegts_atsc_tvct_source_copy (GstMpegTsAtscTVCTSource * source)
static void
_gst_mpegts_atsc_tvct_source_free (GstMpegTsAtscTVCTSource * source)
{
g_ptr_array_unref (source->descriptors);
if (source->descriptors)
g_ptr_array_unref (source->descriptors);
g_slice_free (GstMpegTsAtscTVCTSource, source);
}
......@@ -73,7 +74,8 @@ static void
_gst_mpegts_atsc_tvct_free (GstMpegTsAtscTVCT * tvct)
{
g_ptr_array_unref (tvct->sources);
g_ptr_array_unref (tvct->descriptors);
if (tvct->descriptors)
g_ptr_array_unref (tvct->descriptors);
g_slice_free (GstMpegTsAtscTVCT, tvct);
}
......
......@@ -112,7 +112,8 @@ _gst_mpegts_eit_event_free (GstMpegTsEITEvent * eit)
{
if (eit->start_time)
gst_date_time_unref (eit->start_time);
g_ptr_array_unref (eit->descriptors);
if (eit->descriptors)
g_ptr_array_unref (eit->descriptors);
g_slice_free (GstMpegTsEITEvent, eit);
}
......@@ -141,7 +142,6 @@ _gst_mpegts_eit_free (GstMpegTsEIT * eit)
G_DEFINE_BOXED_TYPE (GstMpegTsEIT, gst_mpegts_eit,
(GBoxedCopyFunc) _gst_mpegts_eit_copy, (GFreeFunc) _gst_mpegts_eit_free);
static gpointer
_parse_eit (GstMpegTsSection * section)
{
......@@ -267,7 +267,8 @@ _gst_mpegts_bat_stream_copy (GstMpegTsBATStream * bat)
static void
_gst_mpegts_bat_stream_free (GstMpegTsBATStream * bat)
{
g_ptr_array_unref (bat->descriptors);
if (bat->descriptors)
g_ptr_array_unref (bat->descriptors);
g_slice_free (GstMpegTsBATStream, bat);
}
......@@ -290,8 +291,10 @@ _gst_mpegts_bat_copy (GstMpegTsBAT * bat)
static void
_gst_mpegts_bat_free (GstMpegTsBAT * bat)
{
g_ptr_array_unref (bat->descriptors);
g_ptr_array_unref (bat->streams);
if (bat->descriptors)
g_ptr_array_unref (bat->descriptors);
if (bat->streams)
g_ptr_array_unref (bat->streams);
g_slice_free (GstMpegTsBAT, bat);
}
......@@ -443,7 +446,8 @@ _gst_mpegts_nit_stream_copy (GstMpegTsNITStream * nit)
static void
_gst_mpegts_nit_stream_free (GstMpegTsNITStream * nit)
{
g_ptr_array_unref (nit->descriptors);
if (nit->descriptors)
g_ptr_array_unref (nit->descriptors);
g_slice_free (GstMpegTsNITStream, nit);
}
......@@ -465,7 +469,8 @@ _gst_mpegts_nit_copy (GstMpegTsNIT * nit)
static void
_gst_mpegts_nit_free (GstMpegTsNIT * nit)
{
g_ptr_array_unref (nit->descriptors);
if (nit->descriptors)
g_ptr_array_unref (nit->descriptors);
g_ptr_array_unref (nit->streams);
g_slice_free (GstMpegTsNIT, nit);
}
......@@ -786,7 +791,8 @@ _gst_mpegts_sdt_service_copy (GstMpegTsSDTService * sdt)
static void
_gst_mpegts_sdt_service_free (GstMpegTsSDTService * sdt)
{
g_ptr_array_unref (sdt->descriptors);
if (sdt->descriptors)
g_ptr_array_unref (sdt->descriptors);
g_slice_free (GstMpegTsSDTService, sdt);
}
......@@ -1142,7 +1148,8 @@ _gst_mpegts_tot_free (GstMpegTsTOT * tot)
{
if (tot->utc_time)
gst_date_time_unref (tot->utc_time);
g_ptr_array_unref (tot->descriptors);
if (tot->descriptors)
g_ptr_array_unref (tot->descriptors);
g_slice_free (GstMpegTsTOT, tot);
}
......
......@@ -606,7 +606,8 @@ _gst_mpegts_pmt_stream_copy (GstMpegTsPMTStream * pmt)
static void
_gst_mpegts_pmt_stream_free (GstMpegTsPMTStream * pmt)
{
g_ptr_array_unref (pmt->descriptors);
if (pmt->descriptors)
g_ptr_array_unref (pmt->descriptors);
g_slice_free (GstMpegTsPMTStream, pmt);
}
......@@ -620,7 +621,8 @@ _gst_mpegts_pmt_copy (GstMpegTsPMT * pmt)
GstMpegTsPMT *copy;
copy = g_slice_dup (GstMpegTsPMT, pmt);
copy->descriptors = g_ptr_array_ref (pmt->descriptors);
if (pmt->descriptors)
copy->descriptors = g_ptr_array_ref (pmt->descriptors);
copy->streams = g_ptr_array_ref (pmt->streams);
return copy;
......@@ -629,7 +631,8 @@ _gst_mpegts_pmt_copy (GstMpegTsPMT * pmt)
static void
_gst_mpegts_pmt_free (GstMpegTsPMT * pmt)
{
g_ptr_array_unref (pmt->descriptors);
if (pmt->descriptors)
g_ptr_array_unref (pmt->descriptors);
g_ptr_array_unref (pmt->streams);
g_slice_free (GstMpegTsPMT, pmt);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment