GNOME Bugzilla – Bug 708667
rtspconnection: leaks file descriptors/child sources
Last modified: 2013-09-24 15:35:25 UTC
When watch->writesrc is not attached to a context it's child sources will never be freed. The gsource api in glib looks a bit weird, it only removes child sources from g_source_destroy and only if the source is attached to a context. The problem can be reproduced in different ways, for example: run the gst-rtsp-server unit tests: GST_CHECKS=test_play_smpte_range make gst/rtspserver.valgrind or one of the examples in gst-rtsp-server: ./test-mp4 some.m4v (1 fd is leaked for every RTSP session) I am also going to write a unit test for rtspconnection.c which triggers the problem and attach it to this report.
Created attachment 255614 [details] [review] Only create writesrc when it is actually needed Proposing a patch which only creates writesrc when it is needed and right before attaching it to a context (by adding it as a child source to watch)
commit 8ba90931aed21edd44ddda515665312e49c6b088 Author: Ognyan Tonchev <ognyan@axis.com> Date: Tue Sep 24 12:10:00 2013 +0200 rtspconnection: Only create writesrc when it is actually needed Creating a GSource and not attaching it to a context will cause a leak of it's child sources. That is why we create writesrc right before attaching it to a context. https://bugzilla.gnome.org/show_bug.cgi?id=708667