GNOME Bugzilla – Bug 640542
matroskamux leaks memory after reset
Last modified: 2011-03-08 15:31:48 UTC
Created attachment 179290 [details] [review] unit test which triggers the leak The muxer will leak the ebml_write->caps after reset. I've seen the problem in plugins-good 0.10.24 but i am pretty sure it also exists in the latest version of the muxer. The easiest way to reproduce the leak is: gst_element_state (pipe, GST_STATE_PLAY); gst_element_state (pipe, GST_STATE_NULL); gst_element_state (pipe, GST_STATE_PLAY); and gst_matroska_mux_start () will create new caps without unreffing the old caps. The suggested fix is to unref the caps in gst_ebml_write_reset (): void gst_ebml_write_reset (GstEbmlWrite * ebml) { ebml->pos = 0; if (ebml->cache) { gst_byte_writer_free (ebml->cache); ebml->cache = NULL; } if (ebml->caps) { gst_caps_unref (ebml->caps); ebml->caps = NULL; } ebml->last_write_result = GST_FLOW_OK; ebml->timestamp = GST_CLOCK_TIME_NONE; ebml->need_newsegment = TRUE; } Attached is also a unit test which triggers the problem.
Thanks, should be fixed now (a patch in git format-patch format would be appreciated next time): commit 0add79cbf1612b8a3cdcb8ea0ad41f1e6059282e Author: Ognyan Tonchev <ognyan.tonchev@axis.com> Date: Wed Jan 26 08:48:43 2011 +0000 matroskamux: don't leak ebml writer caps when re-using matroskamux https://bugzilla.gnome.org/show_bug.cgi?id=640542