diff options
author | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2009-08-11 16:23:20 -0400 |
---|---|---|
committer | Olivier Crête <olivier.crete@collabora.co.uk> | 2009-08-12 17:08:01 -0400 |
commit | 0d697e8b58b10d41c20c8fbda87d9ed58291a8fb (patch) | |
tree | ce3d6320e6596cd9b6a85b78319e4cc874c49dd8 | |
parent | 5bc1290431fcab274219bb8055a4b35ea7b335cc (diff) | |
download | gst-plugins-bad-0d697e8b58b10d41c20c8fbda87d9ed58291a8fb.tar.gz gst-plugins-bad-0d697e8b58b10d41c20c8fbda87d9ed58291a8fb.tar.bz2 gst-plugins-bad-0d697e8b58b10d41c20c8fbda87d9ed58291a8fb.zip |
rtpdtmfsrc: Cleanup events on finalize
Problem found by Laurent Glayal
Fixes bug #591440
-rw-r--r-- | gst/dtmf/gstrtpdtmfsrc.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/gst/dtmf/gstrtpdtmfsrc.c b/gst/dtmf/gstrtpdtmfsrc.c index 738be59e..cdaa202a 100644 --- a/gst/dtmf/gstrtpdtmfsrc.c +++ b/gst/dtmf/gstrtpdtmfsrc.c @@ -302,6 +302,16 @@ gst_rtp_dtmf_src_class_init (GstRTPDTMFSrcClass * klass) } static void +gst_rtp_dtmf_src_event_free (GstRTPDTMFSrcEvent * event) +{ + if (event) { + g_free (event->payload); + event->payload = NULL; + g_free (event); + } +} + +static void gst_rtp_dtmf_src_init (GstRTPDTMFSrc * object, GstRTPDTMFSrcClass * g_class) { gst_base_src_set_format (GST_BASE_SRC (object), GST_FORMAT_TIME); @@ -315,7 +325,8 @@ gst_rtp_dtmf_src_init (GstRTPDTMFSrc * object, GstRTPDTMFSrcClass * g_class) object->interval = DEFAULT_PACKET_INTERVAL; object->packet_redundancy = DEFAULT_PACKET_REDUNDANCY; - object->event_queue = g_async_queue_new (); + object->event_queue = + g_async_queue_new_full ((GDestroyNotify) gst_rtp_dtmf_src_event_free); object->payload = NULL; GST_DEBUG_OBJECT (object, "init done"); @@ -997,7 +1008,7 @@ gst_rtp_dtmf_src_change_state (GstElement * element, GstStateChange transition) /* Flushing the event queue */ while ((event = g_async_queue_try_pop (dtmfsrc->event_queue)) != NULL) - g_free (event); + gst_rtp_dtmf_src_event_free (event); no_preroll = TRUE; break; @@ -1018,7 +1029,7 @@ gst_rtp_dtmf_src_change_state (GstElement * element, GstStateChange transition) /* Flushing the event queue */ while ((event = g_async_queue_try_pop (dtmfsrc->event_queue)) != NULL) - g_free (event); + gst_rtp_dtmf_src_event_free (event); /* Indicate that we don't do PRE_ROLL */ break; |