mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 14:08:56 +00:00
gst-rtsp-server: Plug a few memory leaks in tests
Found and fixed a few memory leaks in the gst_rtspserver, gst_onvif and gst_stream tests by running the tests in valgrind. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1742>
This commit is contained in:
parent
b11084f729
commit
52c0763042
3 changed files with 21 additions and 1 deletions
|
@ -111,6 +111,9 @@ GType test_src_get_type (void);
|
||||||
#define test_src_parent_class parent_class
|
#define test_src_parent_class parent_class
|
||||||
G_DEFINE_TYPE (TestSrc, test_src, GST_TYPE_PUSH_SRC);
|
G_DEFINE_TYPE (TestSrc, test_src, GST_TYPE_PUSH_SRC);
|
||||||
|
|
||||||
|
#define TEST_SRC(obj) \
|
||||||
|
(G_TYPE_CHECK_INSTANCE_CAST ((obj), test_src_get_type(), TestSrc))
|
||||||
|
|
||||||
#define ROUND_UP_TO_10(x) (((x + 10 - 1) / 10) * 10)
|
#define ROUND_UP_TO_10(x) (((x + 10 - 1) / 10) * 10)
|
||||||
#define ROUND_DOWN_TO_10(x) (x - (x % 10))
|
#define ROUND_DOWN_TO_10(x) (x - (x % 10))
|
||||||
|
|
||||||
|
@ -241,6 +244,17 @@ test_src_init (TestSrc * src)
|
||||||
src->ntp_offset = GST_CLOCK_TIME_NONE;
|
src->ntp_offset = GST_CLOCK_TIME_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_src_finalize (GObject * obj)
|
||||||
|
{
|
||||||
|
TestSrc *src = TEST_SRC (obj);
|
||||||
|
|
||||||
|
if (src->segment != NULL)
|
||||||
|
gst_segment_free (src->segment);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (test_src_parent_class)->finalize (obj);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We support seeking, both this method and GstBaseSrc.do_seek must
|
* We support seeking, both this method and GstBaseSrc.do_seek must
|
||||||
* be implemented for GstBaseSrc to report TRUE in the seeking query.
|
* be implemented for GstBaseSrc to report TRUE in the seeking query.
|
||||||
|
@ -304,6 +318,8 @@ test_src_event (GstBaseSrc * bsrc, GstEvent * event)
|
||||||
static void
|
static void
|
||||||
test_src_class_init (TestSrcClass * klass)
|
test_src_class_init (TestSrcClass * klass)
|
||||||
{
|
{
|
||||||
|
G_OBJECT_CLASS (klass)->finalize = test_src_finalize;
|
||||||
|
|
||||||
gst_element_class_add_static_pad_template (GST_ELEMENT_CLASS (klass),
|
gst_element_class_add_static_pad_template (GST_ELEMENT_CLASS (klass),
|
||||||
&test_src_template);
|
&test_src_template);
|
||||||
GST_PUSH_SRC_CLASS (klass)->create = test_src_create;
|
GST_PUSH_SRC_CLASS (klass)->create = test_src_create;
|
||||||
|
@ -457,6 +473,7 @@ test_response_x_onvif_track (GstRTSPClient * client, GstRTSPMessage * response,
|
||||||
|
|
||||||
fail_unless_equals_string (gst_sdp_media_get_attribute_val (smedia,
|
fail_unless_equals_string (gst_sdp_media_get_attribute_val (smedia,
|
||||||
"x-onvif-track"), x_onvif_track);
|
"x-onvif-track"), x_onvif_track);
|
||||||
|
g_free (x_onvif_track);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_sdp_message_free (sdp);
|
gst_sdp_message_free (sdp);
|
||||||
|
|
|
@ -2401,6 +2401,8 @@ GST_START_TEST (test_record_tcp)
|
||||||
stop_server ();
|
stop_server ();
|
||||||
iterate ();
|
iterate ();
|
||||||
g_free (session);
|
g_free (session);
|
||||||
|
/* release the reference to server_sink, obtained in media_constructed_cb */
|
||||||
|
gst_object_unref (server_sink);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
@ -2698,6 +2700,7 @@ GST_START_TEST (test_double_play)
|
||||||
|
|
||||||
stop_server ();
|
stop_server ();
|
||||||
iterate ();
|
iterate ();
|
||||||
|
g_object_unref (client);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
|
@ -632,8 +632,8 @@ add_transports (gboolean add_twice)
|
||||||
fail_if (gst_rtsp_stream_remove_transport (stream, tr));
|
fail_if (gst_rtsp_stream_remove_transport (stream, tr));
|
||||||
}
|
}
|
||||||
|
|
||||||
fail_unless (gst_rtsp_transport_free (transport) == GST_RTSP_OK);
|
|
||||||
fail_unless (gst_rtsp_stream_leave_bin (stream, bin, rtpbin));
|
fail_unless (gst_rtsp_stream_leave_bin (stream, bin, rtpbin));
|
||||||
|
g_object_unref (tr);
|
||||||
gst_object_unref (bin);
|
gst_object_unref (bin);
|
||||||
gst_object_unref (stream);
|
gst_object_unref (stream);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue