rtsp-server: tests: Fix a few memory leaks

Also use any port to run server to avoid conflicts.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9116>
This commit is contained in:
Doug Nazar 2025-05-28 09:13:46 -04:00 committed by GStreamer Marge Bot
parent feb6e1602a
commit 581e72a23e
3 changed files with 9 additions and 0 deletions

View File

@ -207,6 +207,7 @@ test_src_create (GstPushSrc * psrc, GstBuffer ** buffer)
onvif_event = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM, s);
gst_element_send_event (GST_ELEMENT (src), onvif_event);
gst_object_unref (clock);
}
if (src->segment->rate < 1.0) {

View File

@ -2403,6 +2403,8 @@ GST_START_TEST (test_record_tcp)
g_free (session);
/* release the reference to server_sink, obtained in media_constructed_cb */
gst_object_unref (server_sink);
gst_rtsp_thread_pool_cleanup ();
}
GST_END_TEST;

View File

@ -64,6 +64,9 @@ main (int argc, char *argv[])
/* create a server instance */
server = gst_rtsp_server_new ();
/* set port to any */
gst_rtsp_server_set_service (server, "0");
/* attach the server to the default maincontext */
if ((id = gst_rtsp_server_attach (server, NULL)) == 0)
goto failed;
@ -84,6 +87,9 @@ main (int argc, char *argv[])
/* ERRORS */
failed:
{
g_object_unref (server);
g_main_loop_unref (loop);
g_print ("failed to attach the server\n");
return -1;
}