diff options
author | Linus Svensson <linusp.svensson@gmail.com> | 2014-04-11 23:52:49 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2014-04-12 06:15:03 +0200 |
commit | 9219509bcfbc84b6c9d826b60b1d88f1619f016e (patch) | |
tree | 270b7f01ac30c9b5e49747a404b7c101791e9202 /tests | |
parent | 80474e9e5e0f17c44d553192a2281d17c4ff2015 (diff) |
rtsp-session-pool: Fixes annotation
Fixes annotation for gst_rtsp_session_pool_create() and memory leaks
in the sessionpool test.
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=728060
Diffstat (limited to 'tests')
-rw-r--r-- | tests/check/gst/sessionpool.c | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/tests/check/gst/sessionpool.c b/tests/check/gst/sessionpool.c index a0de375..c1cc149 100644 --- a/tests/check/gst/sessionpool.c +++ b/tests/check/gst/sessionpool.c @@ -44,7 +44,8 @@ GST_START_TEST (test_pool) { GstRTSPSessionPool *pool; GstRTSPSession *session1, *session2, *session3; - const gchar *session1id, *session2id, *session3id; + GstRTSPSession *compare; + gchar *session1id, *session2id, *session3id; GList *list; guint maxsessions; GSource *source; @@ -61,28 +62,35 @@ GST_START_TEST (test_pool) fail_unless (GST_IS_RTSP_SESSION (session1)); fail_unless_equals_int (gst_rtsp_session_pool_get_n_sessions (pool), 1); fail_unless_equals_int (gst_rtsp_session_pool_get_max_sessions (pool), 3); - session1id = gst_rtsp_session_get_sessionid (session1); + session1id = g_strdup (gst_rtsp_session_get_sessionid (session1)); session2 = gst_rtsp_session_pool_create (pool); fail_unless (GST_IS_RTSP_SESSION (session2)); fail_unless_equals_int (gst_rtsp_session_pool_get_n_sessions (pool), 2); fail_unless_equals_int (gst_rtsp_session_pool_get_max_sessions (pool), 3); - session2id = gst_rtsp_session_get_sessionid (session2); + session2id = g_strdup (gst_rtsp_session_get_sessionid (session2)); session3 = gst_rtsp_session_pool_create (pool); fail_unless (GST_IS_RTSP_SESSION (session3)); fail_unless_equals_int (gst_rtsp_session_pool_get_n_sessions (pool), 3); fail_unless_equals_int (gst_rtsp_session_pool_get_max_sessions (pool), 3); - session3id = gst_rtsp_session_get_sessionid (session3); + session3id = g_strdup (gst_rtsp_session_get_sessionid (session3)); fail_if (GST_IS_RTSP_SESSION (gst_rtsp_session_pool_create (pool))); - fail_unless (gst_rtsp_session_pool_find (pool, session1id) == session1); - fail_unless (gst_rtsp_session_pool_find (pool, session2id) == session2); - fail_unless (gst_rtsp_session_pool_find (pool, session3id) == session3); + compare = gst_rtsp_session_pool_find (pool, session1id); + fail_unless (compare == session1); + g_object_unref (compare); + compare = gst_rtsp_session_pool_find (pool, session2id); + fail_unless (compare == session2); + g_object_unref (compare); + compare = gst_rtsp_session_pool_find (pool, session3id); + fail_unless (compare == session3); + g_object_unref (compare); fail_unless (gst_rtsp_session_pool_find (pool, "") == NULL); fail_unless (gst_rtsp_session_pool_remove (pool, session2)); + g_object_unref (session2); fail_unless_equals_int (gst_rtsp_session_pool_get_n_sessions (pool), 2); fail_unless_equals_int (gst_rtsp_session_pool_get_max_sessions (pool), 3); @@ -98,7 +106,7 @@ GST_START_TEST (test_pool) fail_unless_equals_int (g_list_length (list), 2); fail_unless (g_list_find (list, session1) != NULL); fail_unless (g_list_find (list, session3) != NULL); - g_list_foreach (list, (GFunc) g_object_unref, NULL); + g_list_free_full (list, (GDestroyNotify) g_object_unref); } { @@ -120,7 +128,7 @@ GST_START_TEST (test_pool) list = gst_rtsp_session_pool_filter (pool, filter_func, &responses); fail_unless_equals_int (g_list_length (list), 1); fail_unless (g_list_nth_data (list, 0) == session1); - g_list_foreach (list, (GFunc) g_object_unref, NULL); + g_list_free_full (list, (GDestroyNotify) g_object_unref); } { @@ -131,9 +139,12 @@ GST_START_TEST (test_pool) list = gst_rtsp_session_pool_filter (pool, filter_func, &responses); fail_unless_equals_int (g_list_length (list), 0); + g_list_free (list); } - fail_unless (gst_rtsp_session_pool_find (pool, session1id) == session1); + compare = gst_rtsp_session_pool_find (pool, session1id); + fail_unless (compare == session1); + g_object_unref (compare); fail_unless (gst_rtsp_session_pool_find (pool, session2id) == NULL); fail_unless (gst_rtsp_session_pool_find (pool, session3id) == NULL); @@ -158,6 +169,13 @@ GST_START_TEST (test_pool) g_source_unref (source); + g_object_unref (session1); + g_object_unref (session3); + + g_free (session1id); + g_free (session2id); + g_free (session3id); + g_object_unref (pool); } |