diff --git a/gst/rtp/gstrtptheorapay.c b/gst/rtp/gstrtptheorapay.c index cf5c485522..802a335afd 100644 --- a/gst/rtp/gstrtptheorapay.c +++ b/gst/rtp/gstrtptheorapay.c @@ -153,22 +153,17 @@ gst_rtp_theora_pay_clear_packet (GstRtpTheoraPay * rtptheorapay) if (rtptheorapay->packet) gst_buffer_unref (rtptheorapay->packet); rtptheorapay->packet = NULL; - - g_list_foreach (rtptheorapay->packet_buffers, (GFunc) gst_mini_object_unref, - NULL); - g_list_free (rtptheorapay->packet_buffers); + g_list_free_full (rtptheorapay->packet_buffers, + (GDestroyNotify) gst_buffer_unref); rtptheorapay->packet_buffers = NULL; } static void gst_rtp_theora_pay_cleanup (GstRtpTheoraPay * rtptheorapay) { - g_list_foreach (rtptheorapay->headers, (GFunc) gst_mini_object_unref, NULL); - g_list_free (rtptheorapay->headers); - rtptheorapay->headers = NULL; - gst_rtp_theora_pay_clear_packet (rtptheorapay); - + g_list_free_full (rtptheorapay->headers, (GDestroyNotify) gst_buffer_unref); + rtptheorapay->headers = NULL; if (rtptheorapay->config_data) g_free (rtptheorapay->config_data); rtptheorapay->config_data = NULL; @@ -283,13 +278,7 @@ gst_rtp_theora_pay_init_packet (GstRtpTheoraPay * rtptheorapay, guint8 TDT, { GST_DEBUG_OBJECT (rtptheorapay, "starting new packet, TDT: %d", TDT); - if (rtptheorapay->packet) - gst_buffer_unref (rtptheorapay->packet); - - g_list_foreach (rtptheorapay->packet_buffers, (GFunc) gst_mini_object_unref, - NULL); - g_list_free (rtptheorapay->packet_buffers); - rtptheorapay->packet_buffers = NULL; + gst_rtp_theora_pay_clear_packet (rtptheorapay); /* new packet allocate max packet size */ rtptheorapay->packet = diff --git a/gst/rtp/gstrtpvorbisdepay.c b/gst/rtp/gstrtpvorbisdepay.c index bc13a04e17..bd2f78faf5 100644 --- a/gst/rtp/gstrtpvorbisdepay.c +++ b/gst/rtp/gstrtpvorbisdepay.c @@ -113,26 +113,14 @@ gst_rtp_vorbis_depay_init (GstRtpVorbisDepay * rtpvorbisdepay) static void free_config (GstRtpVorbisConfig * conf) { - GList *headers; - - for (headers = conf->headers; headers; headers = g_list_next (headers)) { - GstBuffer *header = GST_BUFFER_CAST (headers->data); - - gst_buffer_unref (header); - } - g_list_free (conf->headers); + g_list_free_full (conf->headers, (GDestroyNotify) gst_buffer_unref); g_free (conf); } static void free_indents (GstRtpVorbisDepay * rtpvorbisdepay) { - GList *walk; - - for (walk = rtpvorbisdepay->configs; walk; walk = g_list_next (walk)) { - free_config ((GstRtpVorbisConfig *) walk->data); - } - g_list_free (rtpvorbisdepay->configs); + g_list_free_full (rtpvorbisdepay->configs, (GDestroyNotify) free_config); rtpvorbisdepay->configs = NULL; } diff --git a/gst/rtp/gstrtpvorbispay.c b/gst/rtp/gstrtpvorbispay.c index bd8ee416d3..43507056ff 100644 --- a/gst/rtp/gstrtpvorbispay.c +++ b/gst/rtp/gstrtpvorbispay.c @@ -145,21 +145,17 @@ gst_rtp_vorbis_pay_clear_packet (GstRtpVorbisPay * rtpvorbispay) if (rtpvorbispay->packet) gst_buffer_unref (rtpvorbispay->packet); rtpvorbispay->packet = NULL; - g_list_foreach (rtpvorbispay->packet_buffers, (GFunc) gst_mini_object_unref, - NULL); - g_list_free (rtpvorbispay->packet_buffers); + g_list_free_full (rtpvorbispay->packet_buffers, + (GDestroyNotify) gst_buffer_unref); rtpvorbispay->packet_buffers = NULL; } static void gst_rtp_vorbis_pay_cleanup (GstRtpVorbisPay * rtpvorbispay) { - g_list_foreach (rtpvorbispay->headers, (GFunc) gst_mini_object_unref, NULL); - g_list_free (rtpvorbispay->headers); - rtpvorbispay->headers = NULL; - gst_rtp_vorbis_pay_clear_packet (rtpvorbispay); - + g_list_free_full (rtpvorbispay->headers, (GDestroyNotify) gst_buffer_unref); + rtpvorbispay->headers = NULL; if (rtpvorbispay->config_data) g_free (rtpvorbispay->config_data); rtpvorbispay->config_data = NULL; @@ -277,12 +273,7 @@ gst_rtp_vorbis_pay_init_packet (GstRtpVorbisPay * rtpvorbispay, guint8 VDT, { GST_LOG_OBJECT (rtpvorbispay, "starting new packet, VDT: %d", VDT); - if (rtpvorbispay->packet) - gst_buffer_unref (rtpvorbispay->packet); - g_list_foreach (rtpvorbispay->packet_buffers, (GFunc) gst_mini_object_unref, - NULL); - g_list_free (rtpvorbispay->packet_buffers); - rtpvorbispay->packet_buffers = NULL; + gst_rtp_vorbis_pay_clear_packet (rtpvorbispay); /* new packet allocate max packet size */ rtpvorbispay->packet =