From: Thiago Santos Date: Thu, 15 May 2014 22:16:30 +0000 (-0300) Subject: mpegts: sections: prevent assertion when packet parsing fails X-Git-Tag: 1.19.3~507^2~11098 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f99fe4747eb6bf42155e6fe7a55ecc03074cdf54;p=platform%2Fupstream%2Fgstreamer.git mpegts: sections: prevent assertion when packet parsing fails the descriptors entry can be left as NULL and freeing the structure will fail (assertion happens) --- diff --git a/gst-libs/gst/mpegts/gst-atsc-section.c b/gst-libs/gst/mpegts/gst-atsc-section.c index 8452cdf..a56be15 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 ad2b3fb..0a62c1c 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 3769118..97a7e4a 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); }