After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 591440 - rtpdtmfsrc event cleanup
rtpdtmfsrc event cleanup
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 0.10.14
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-08-11 12:23 UTC by Laurent Glayal
Modified: 2009-08-12 21:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
event cleanup (666 bytes, patch)
2009-08-11 12:48 UTC, Laurent Glayal
rejected Details | Review
alternative patch (1.66 KB, patch)
2009-08-11 13:35 UTC, Tim-Philipp Müller
accepted-commit_after_freeze Details | Review
rtpdtmfsrc: Cleanup events on finalize (3.67 KB, patch)
2009-08-11 20:45 UTC, Olivier Crête
committed Details | Review
dtmf: Use GSlice for internal event structures (5.64 KB, patch)
2009-08-11 20:45 UTC, Olivier Crête
committed Details | Review
dtmfsrc: Empty event queue on finalize (1.16 KB, patch)
2009-08-11 20:45 UTC, Olivier Crête
committed Details | Review

Description Laurent Glayal 2009-08-11 12:23:41 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);
}
Comment 1 Laurent Glayal 2009-08-11 12:48:06 UTC
Created attachment 140433 [details] [review]
event cleanup
Comment 2 Tim-Philipp Müller 2009-08-11 13:35:39 UTC
Created attachment 140437 [details] [review]
alternative patch

How about this?
Comment 3 Olivier Crête 2009-08-11 13:42:58 UTC
I like Tim's patch better, I guess we can commit it after the freeze.
Comment 4 Tim-Philipp Müller 2009-08-11 13:57:01 UTC
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).
Comment 5 Olivier Crête 2009-08-11 20:45:13 UTC
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).
Comment 6 Olivier Crête 2009-08-11 20:45:33 UTC
Created attachment 140483 [details] [review]
dtmf: Use GSlice for internal event structures
Comment 7 Olivier Crête 2009-08-11 20:45:47 UTC
Created attachment 140484 [details] [review]
dtmfsrc: Empty event queue on finalize
Comment 8 Tim-Philipp Müller 2009-08-12 20:58:58 UTC
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!
Comment 9 Olivier Crête 2009-08-12 21:09:14 UTC
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