From a2ea288a0259c8c30bf8407b066d8edbdffdb954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 11 Aug 2009 16:23:20 -0400 Subject: [PATCH] rtpdtmfsrc: Cleanup events on finalize Problem found by Laurent Glayal Fixes bug #591440 --- gst/dtmf/gstrtpdtmfsrc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gst/dtmf/gstrtpdtmfsrc.c b/gst/dtmf/gstrtpdtmfsrc.c index cdaa202a42..b41c0c459c 100644 --- a/gst/dtmf/gstrtpdtmfsrc.c +++ b/gst/dtmf/gstrtpdtmfsrc.c @@ -583,7 +583,7 @@ static void gst_rtp_dtmf_src_add_stop_event (GstRTPDTMFSrc * dtmfsrc) { - GstRTPDTMFSrcEvent *event = g_malloc (sizeof (GstRTPDTMFSrcEvent)); + GstRTPDTMFSrcEvent *event = g_new0 (GstRTPDTMFSrcEvent, 1); event->event_type = RTP_DTMF_EVENT_TYPE_STOP; g_async_queue_push (dtmfsrc->event_queue, event); @@ -701,6 +701,7 @@ gst_rtp_dtmf_src_create (GstBaseSrc * basesrc, guint64 offset, gst_rtp_dtmf_src_set_stream_lock (dtmfsrc, TRUE); dtmfsrc->payload = event->payload; + event->payload = NULL; break; case RTP_DTMF_EVENT_TYPE_PAUSE_TASK: @@ -717,7 +718,7 @@ gst_rtp_dtmf_src_create (GstBaseSrc * basesrc, guint64 offset, break; } - g_free (event); + gst_rtp_dtmf_src_event_free (event); } else if (!dtmfsrc->first_packet && !dtmfsrc->last_packet && (dtmfsrc->timestamp - dtmfsrc->start_timestamp) / GST_MSECOND >= MIN_PULSE_DURATION) { @@ -755,7 +756,7 @@ gst_rtp_dtmf_src_create (GstBaseSrc * basesrc, guint64 offset, GST_OBJECT_UNLOCK (dtmfsrc); break; } - g_free (event); + gst_rtp_dtmf_src_event_free (event); } } } while (dtmfsrc->payload == NULL); @@ -1068,7 +1069,7 @@ gst_rtp_dtmf_src_unlock (GstBaseSrc * src) GST_OBJECT_UNLOCK (dtmfsrc); GST_DEBUG_OBJECT (dtmfsrc, "Pushing the PAUSE_TASK event on unlock request"); - event = g_malloc (sizeof (GstRTPDTMFSrcEvent)); + event = g_new0 (GstRTPDTMFSrcEvent, 1); event->event_type = RTP_DTMF_EVENT_TYPE_PAUSE_TASK; g_async_queue_push (dtmfsrc->event_queue, event);