mpegts: sections: prevent assertion when packet parsing fails

the descriptors entry can be left as NULL and freeing the structure
will fail (assertion happens)
This commit is contained in:
Thiago Santos 2014-05-15 19:16:30 -03:00
parent bd34e62872
commit f99fe4747e
3 changed files with 26 additions and 14 deletions

View file

@ -49,6 +49,7 @@ _gst_mpegts_atsc_tvct_source_copy (GstMpegTsAtscTVCTSource * source)
static void
_gst_mpegts_atsc_tvct_source_free (GstMpegTsAtscTVCTSource * source)
{
if (source->descriptors)
g_ptr_array_unref (source->descriptors);
g_slice_free (GstMpegTsAtscTVCTSource, source);
}
@ -73,6 +74,7 @@ static void
_gst_mpegts_atsc_tvct_free (GstMpegTsAtscTVCT * tvct)
{
g_ptr_array_unref (tvct->sources);
if (tvct->descriptors)
g_ptr_array_unref (tvct->descriptors);
g_slice_free (GstMpegTsAtscTVCT, tvct);
}

View file

@ -112,6 +112,7 @@ _gst_mpegts_eit_event_free (GstMpegTsEITEvent * eit)
{
if (eit->start_time)
gst_date_time_unref (eit->start_time);
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,6 +267,7 @@ _gst_mpegts_bat_stream_copy (GstMpegTsBATStream * bat)
static void
_gst_mpegts_bat_stream_free (GstMpegTsBATStream * bat)
{
if (bat->descriptors)
g_ptr_array_unref (bat->descriptors);
g_slice_free (GstMpegTsBATStream, bat);
}
@ -290,7 +291,9 @@ _gst_mpegts_bat_copy (GstMpegTsBAT * bat)
static void
_gst_mpegts_bat_free (GstMpegTsBAT * bat)
{
if (bat->descriptors)
g_ptr_array_unref (bat->descriptors);
if (bat->streams)
g_ptr_array_unref (bat->streams);
g_slice_free (GstMpegTsBAT, bat);
}
@ -443,6 +446,7 @@ _gst_mpegts_nit_stream_copy (GstMpegTsNITStream * nit)
static void
_gst_mpegts_nit_stream_free (GstMpegTsNITStream * nit)
{
if (nit->descriptors)
g_ptr_array_unref (nit->descriptors);
g_slice_free (GstMpegTsNITStream, nit);
}
@ -465,6 +469,7 @@ _gst_mpegts_nit_copy (GstMpegTsNIT * nit)
static void
_gst_mpegts_nit_free (GstMpegTsNIT * nit)
{
if (nit->descriptors)
g_ptr_array_unref (nit->descriptors);
g_ptr_array_unref (nit->streams);
g_slice_free (GstMpegTsNIT, nit);
@ -786,6 +791,7 @@ _gst_mpegts_sdt_service_copy (GstMpegTsSDTService * sdt)
static void
_gst_mpegts_sdt_service_free (GstMpegTsSDTService * sdt)
{
if (sdt->descriptors)
g_ptr_array_unref (sdt->descriptors);
g_slice_free (GstMpegTsSDTService, sdt);
}
@ -1142,6 +1148,7 @@ _gst_mpegts_tot_free (GstMpegTsTOT * tot)
{
if (tot->utc_time)
gst_date_time_unref (tot->utc_time);
if (tot->descriptors)
g_ptr_array_unref (tot->descriptors);
g_slice_free (GstMpegTsTOT, tot);
}

View file

@ -606,6 +606,7 @@ _gst_mpegts_pmt_stream_copy (GstMpegTsPMTStream * pmt)
static void
_gst_mpegts_pmt_stream_free (GstMpegTsPMTStream * pmt)
{
if (pmt->descriptors)
g_ptr_array_unref (pmt->descriptors);
g_slice_free (GstMpegTsPMTStream, pmt);
}
@ -620,6 +621,7 @@ _gst_mpegts_pmt_copy (GstMpegTsPMT * pmt)
GstMpegTsPMT *copy;
copy = g_slice_dup (GstMpegTsPMT, pmt);
if (pmt->descriptors)
copy->descriptors = g_ptr_array_ref (pmt->descriptors);
copy->streams = g_ptr_array_ref (pmt->streams);
@ -629,6 +631,7 @@ _gst_mpegts_pmt_copy (GstMpegTsPMT * pmt)
static void
_gst_mpegts_pmt_free (GstMpegTsPMT * pmt)
{
if (pmt->descriptors)
g_ptr_array_unref (pmt->descriptors);
g_ptr_array_unref (pmt->streams);
g_slice_free (GstMpegTsPMT, pmt);