summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <ts.santos@sisa.samsung.com>2014-05-15 19:16:30 -0300
committerThiago Santos <ts.santos@sisa.samsung.com>2014-05-15 19:25:06 -0300
commitf99fe4747eb6bf42155e6fe7a55ecc03074cdf54 (patch)
tree8730abd0bd1719b56a3b74f03b53f81f5f1c0b57
parentbd34e628722c8916b023e776677b272df8d77eac (diff)
downloadgstreamer-plugins-bad-f99fe4747eb6bf42155e6fe7a55ecc03074cdf54.tar.gz
mpegts: sections: prevent assertion when packet parsing fails
the descriptors entry can be left as NULL and freeing the structure will fail (assertion happens)
-rw-r--r--gst-libs/gst/mpegts/gst-atsc-section.c6
-rw-r--r--gst-libs/gst/mpegts/gst-dvb-section.c25
-rw-r--r--gst-libs/gst/mpegts/gstmpegtssection.c9
3 files changed, 26 insertions, 14 deletions
diff --git a/gst-libs/gst/mpegts/gst-atsc-section.c b/gst-libs/gst/mpegts/gst-atsc-section.c
index 8452cdf66..a56be15d8 100644
--- a/gst-libs/gst/mpegts/gst-atsc-section.c
+++ b/gst-libs/gst/mpegts/gst-atsc-section.c
@@ -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);
}
diff --git a/gst-libs/gst/mpegts/gst-dvb-section.c b/gst-libs/gst/mpegts/gst-dvb-section.c
index ad2b3fb3b..0a62c1cd3 100644
--- a/gst-libs/gst/mpegts/gst-dvb-section.c
+++ b/gst-libs/gst/mpegts/gst-dvb-section.c
@@ -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);
}
diff --git a/gst-libs/gst/mpegts/gstmpegtssection.c b/gst-libs/gst/mpegts/gstmpegtssection.c
index 376911886..97a7e4afb 100644
--- a/gst-libs/gst/mpegts/gstmpegtssection.c
+++ b/gst-libs/gst/mpegts/gstmpegtssection.c
@@ -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);
}