[Bug 678015] New: gst-rtsp-server: issues found with valgrind

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Wed Jun 13 05:59:56 PDT 2012


https://bugzilla.gnome.org/show_bug.cgi?id=678015
  GStreamer | gst-rtsp-server | git

           Summary: gst-rtsp-server: issues found with valgrind
    Classification: Platform
           Product: GStreamer
           Version: git
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gst-rtsp-server
        AssignedTo: gstreamer-bugs at lists.freedesktop.org
        ReportedBy: davidsf at axis.com
         QAContact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---


When running gst-rtsp-server in valgrind, I've found some memory issues (leaks
etc), which are explained below. 5 patches will be attached that are suggested
fixes for those issues.

PATCH #1: In gst_rtsp_media_factory_collect_streams: unref the srcpad that was
retrieved using gst_element_get_static_pad. gst_ghost_pad_new will take one
reference, and the other reference will otherwise give a memory leak.

PATCH #2: Don't use g_object_unref on GstRTSPSessionMedia. GstRTSPSessionMedia
is not a GObject type. When the GstRTSPSession is freed, it will free the
media.

PATCH #3: Changed session media iteration in rtsp-client.c,
client_unlink_session: now don't iterate in session->medias list where items
are removed by gst_rtsp_session_release_media. Instead, repeatedly remove the
first item.

PATCH #4: rtsp-client.c: free transport on no_stream in SETUP handler.

PATCH #5: Avoid calling collect_media_stats from gst_rtsp_media_set_state when
going to state GST_STATE_NULL. The motivation is a leak that can occur if a
TEARDOWN request is handled right before shutting down and unreffing the
GstRTSPServer.

For the TEARDOWN, we have the following calls:

handle_teardown_request
gst_rtsp_session_media_set_state (GST_STATE_NULL)
gst_rtsp_media_set_state (GST_STATE_NULL)
collect_media_stats
gst_element_query_duration

The duration query can lead to a cached GST_QUERY_DURATION message in the
pipeline GstBin. That message holds a reference to the pipeline, which gets a
ref count of 2.

Then, when the server is shut down, gst_rtsp_media_finalize gets called. Here,
the media pipeline is unreffed. But the pipeline ref count is 2, so the
pipeline is not freed.

Patch #5 avoids this by not collecting media stats when going to
GST_STATE_NULL. If I understand correctly, it is not an error to not collect
media stats in this case.

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list