diff options
author | Stefan Ringel <linuxtv@stefanringel.de> | 2014-03-27 13:56:26 +0100 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2014-03-31 14:54:17 +0200 |
commit | 2e051cf412ded99108b59bfae38c910c15cedbf5 (patch) | |
tree | 01e08320d6bfdce7de139dc072ba8e7b4bd5a09b | |
parent | 820685409efb94a6be455e709b156f60ee4fa49f (diff) | |
download | gstreamer-plugins-bad-2e051cf412ded99108b59bfae38c910c15cedbf5.tar.gz |
mpegts: use glib alloc and free
Signed-off-by: Stefan Ringel <linuxtv@stefanringel.de>
https://bugzilla.gnome.org/show_bug.cgi?id=727159
-rw-r--r-- | gst-libs/gst/mpegts/gst-dvb-descriptor.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/gst-libs/gst/mpegts/gst-dvb-descriptor.c b/gst-libs/gst/mpegts/gst-dvb-descriptor.c index 58b13e121..2560c424f 100644 --- a/gst-libs/gst/mpegts/gst-dvb-descriptor.c +++ b/gst-libs/gst/mpegts/gst-dvb-descriptor.c @@ -558,6 +558,13 @@ gst_mpegts_descriptor_from_dvb_subtitling (const gchar * lang, } /* GST_MTS_DESC_DVB_EXTENDED_EVENT (0x4E) */ + +static void +_gst_mpegts_extended_event_item_free (GstMpegTsExtendedEventItem * item) +{ + g_slice_free (GstMpegTsExtendedEventItem, item); +} + /** * gst_mpegts_descriptor_parse_dvb_extended_event: * @descriptor: a %GST_MTS_DESC_DVB_EXTENDED_EVENT #GstMpegTsDescriptor @@ -596,11 +603,12 @@ gst_mpegts_descriptor_parse_dvb_extended_event (const GstMpegTsDescriptor data += 1; res->nb_items = 0; - res->items = g_ptr_array_new (); + res->items = g_ptr_array_new_with_free_func ((GDestroyNotify) + _gst_mpegts_extended_event_item_free); for (guint i = 0; i < len_item;) { desc_data = data; - item = malloc (sizeof (GstMpegTsExtendedEventItem)); + item = g_slice_new0 (GstMpegTsExtendedEventItem); item->item_description = get_encoding_and_convert ((const gchar *) desc_data + 1, *desc_data); @@ -666,6 +674,12 @@ gst_mpegts_descriptor_parse_dvb_component (const GstMpegTsDescriptor } /* GST_MTS_DESC_DVB_CONTENT (0x54) */ +static void +_gst_mpegts_content_free (GstMpegTsContent * content) +{ + g_slice_free (GstMpegTsContent, content); +} + /** * gst_mpegts_descriptor_parse_dvb_content: * @descriptor: a %GST_MTS_DESC_DVB_CONTENT #GstMpegTsDescriptor @@ -688,9 +702,10 @@ gst_mpegts_descriptor_parse_dvb_content (const GstMpegTsDescriptor data = (guint8 *) descriptor->data + 2; len = descriptor->length; - *content = g_ptr_array_new (); + *content = g_ptr_array_new_with_free_func ((GDestroyNotify) + _gst_mpegts_content_free); for (guint8 i = 0; i < len;) { - GstMpegTsContent *cont = malloc (sizeof (GstMpegTsContent)); + GstMpegTsContent *cont = g_slice_new0 (GstMpegTsContent); tmp = *data; cont->content_nibble_1 = (tmp & 0xf0) >> 4; cont->content_nibble_2 = tmp & 0x0f; |