summaryrefslogtreecommitdiff
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2010-01-30 19:12:24 (GMT)
committer Tim-Philipp Müller <tim.muller@collabora.co.uk>2010-01-30 19:15:15 (GMT)
commitcd6b16734eeeaa7d73b6a62febac068459cf6882 (patch) (side-by-side diff)
treec96afd6592f55b9f41210a1a035367ddd365e283
parent4cb5f323080a493d6a102afe9cb7700eee3410a3 (diff)
downloadgst-plugins-ugly-cd6b16734eeeaa7d73b6a62febac068459cf6882.zip
gst-plugins-ugly-cd6b16734eeeaa7d73b6a62febac068459cf6882.tar.gz
rtspreal: add finalize function so we can free streams and rulebook
Fix memory leak in Real RTSP component (#608533).
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--gst/realmedia/rtspreal.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gst/realmedia/rtspreal.c b/gst/realmedia/rtspreal.c
index 1c07030..07f1df0 100644
--- a/gst/realmedia/rtspreal.c
+++ b/gst/realmedia/rtspreal.c
@@ -669,6 +669,7 @@ reset:
static void gst_rtsp_real_extension_init (gpointer g_iface,
gpointer iface_data);
+static void gst_rtsp_real_finalize (GObject * obj);
static void
_do_init (GType rtspreal_type)
@@ -697,6 +698,10 @@ gst_rtsp_real_base_init (gpointer klass)
static void
gst_rtsp_real_class_init (GstRTSPRealClass * g_class)
{
+ GObjectClass *gobject_class = (GObjectClass *) g_class;
+
+ gobject_class->finalize = gst_rtsp_real_finalize;
+
GST_DEBUG_CATEGORY_INIT (rtspreal_debug, "rtspreal", 0,
"RealMedia RTSP extension");
}
@@ -708,6 +713,29 @@ gst_rtsp_real_init (GstRTSPReal * rtspreal, GstRTSPRealClass * klass)
}
static void
+gst_rtsp_stream_free (GstRTSPRealStream * stream)
+{
+ g_free (stream->stream_name);
+ g_free (stream->mime_type);
+ gst_asm_rule_book_free (stream->rulebook);
+ g_free (stream->type_specific_data);
+
+ g_free (stream);
+}
+
+static void
+gst_rtsp_real_finalize (GObject * obj)
+{
+ GstRTSPReal *r = (GstRTSPReal *) obj;
+
+ g_list_foreach (r->streams, (GFunc) gst_rtsp_stream_free, NULL);
+ g_list_free (r->streams);
+ g_free (r->rules);
+
+ G_OBJECT_CLASS (parent_class)->finalize (obj);
+}
+
+static void
gst_rtsp_real_extension_init (gpointer g_iface, gpointer iface_data)
{
GstRTSPExtensionInterface *iface = (GstRTSPExtensionInterface *) g_iface;