GNOME Bugzilla – Bug 591440
rtpdtmfsrc event cleanup
Last modified: 2009-08-12 21:09:14 UTC
cleanup events on finalize to avoid memleaks, sorry for the dirty format of this patch. static void gst_rtp_dtmf_src_finalize (GObject * object) { GstRTPDTMFSrc *dtmfsrc; + GstRTPDTMFSrcEvent *event; dtmfsrc = GST_RTP_DTMF_SRC (object); + /* Flush queue */ + while ((event = g_async_queue_try_pop((dtmfsrc->event_queue)))) { + if (event->payload) { + g_free(event->payload); + event->payload = NULL; + } + g_free(event) ; + } if (dtmfsrc->event_queue) { g_async_queue_unref (dtmfsrc->event_queue); dtmfsrc->event_queue = NULL; } G_OBJECT_CLASS (parent_class)->finalize (object); }
Created attachment 140433 [details] [review] event cleanup
Created attachment 140437 [details] [review] alternative patch How about this?
I like Tim's patch better, I guess we can commit it after the freeze.
Well, since I haven't rolled prereleases yet, I'm happy to merge it now if you think it's safe (I haven't actually run the code).
Created attachment 140482 [details] [review] rtpdtmfsrc: Cleanup events on finalize Actually, the last patch doesn't work either, since the event structure is not initialized to 0.. Attaching an updared patch that does that. As well as patches to move the events to use GSlice and fix the same problem in dtmfsrc (the sound one).
Created attachment 140483 [details] [review] dtmf: Use GSlice for internal event structures
Created attachment 140484 [details] [review] dtmfsrc: Empty event queue on finalize
I'm not exactly thrilled about putting the g_malloc to GSlice change in as well, but assuming you've tested this, feel free to push it all now. Thanks!
commit 402aad7e871ab242ef16c8c715c50e5a2c236f9a Author: Olivier Crête <olivier.crete@collabora.co.uk> Date: Tue Aug 11 16:42:51 2009 -0400 dtmfsrc: Empty event queue on finalize commit 329b7b9849daf784afb6e43fdf2e5dd7ea396e7a Author: Olivier Crête <olivier.crete@collabora.co.uk> Date: Tue Aug 11 16:39:42 2009 -0400 dtmf: Use GSlice for internal event structures commit a2ea288a0259c8c30bf8407b066d8edbdffdb954 Author: Tim-Philipp Müller <tim.muller@collabora.co.uk> Date: Tue Aug 11 16:23:20 2009 -0400 rtpdtmfsrc: Cleanup events on finalize Problem found by Laurent Glayal Fixes bug #591440