[libsoup] tests: fix a few leaks, update valgrind suppressions file



commit 9d940957b8ffd208a77eb357ba91a4e887f80deb
Author: Dan Winship <danw gnome org>
Date:   Sat Sep 17 12:21:36 2011 -0400

    tests: fix a few leaks, update valgrind suppressions file

 tests/libsoup.supp     |  127 +++++++++++++++++++++++++++++++++++++++++++++++-
 tests/misc-test.c      |    7 +++
 tests/requester-test.c |    4 +-
 tests/timeout-test.c   |    1 +
 4 files changed, 137 insertions(+), 2 deletions(-)
---
diff --git a/tests/libsoup.supp b/tests/libsoup.supp
index 69a72ac..4fcb1b8 100644
--- a/tests/libsoup.supp
+++ b/tests/libsoup.supp
@@ -107,6 +107,12 @@
    fun:get_dispatch
 }
 {
+   glib/g_signal_connect
+   Memcheck:Leak
+   ...
+   fun:handler_list_ensure
+}
+{
    glib/g_signal_handlers_destroy
    Memcheck:Leak
    ...
@@ -167,12 +173,31 @@
    fun:_g_io_modules_ensure_loaded
 }
 {
-   glib/tlsinit
+   glib/proxydefault
+   Memcheck:Leak
+   ...
+   fun:get_default_proxy_resolver
+}
+{
+   glib/proxysettings
+   Memcheck:Leak
+   ...
+   fun:update_settings
+   fun:g_proxy_resolver_gnome_lookup
+}
+{
+   glib/tlsdefault
    Memcheck:Leak
    ...
    fun:get_default_tls_backend
 }
 {
+   glib/tlsdb
+   Memcheck:Leak
+   ...
+   fun:g_tls_backend_get_default_database
+}
+{
    glib/tlscrypto
    Memcheck:Leak
    ...
@@ -197,7 +222,101 @@
    fun:ensure_attribute_hash
    fun:lookup_attribute
 }
+{
+  glib/unixsignalthread
+  Memcheck:Leak
+  ...
+  fun:ensure_unix_signal_handler_installed_unlocked
+}
+{
+  glib/gioscheduler
+  Memcheck:Leak
+  ...
+  fun:init_scheduler
+}
+{
+   glib/gtestinit
+   Memcheck:Leak
+   ...
+   fun:g_test_init
+}
+{
+   glib/gtestroot
+   Memcheck:Leak
+   ...
+   fun:g_test_get_root
+}
+{
+   glib/gtestseed
+   Memcheck:Leak
+   ...
+   fun:test_run_seed
+}
+{
+   glib/gtestcase
+   Memcheck:Leak
+   ...
+   fun:g_test_create_case
+}
+{
+   glib/gtestsuite
+   Memcheck:Leak
+   ...
+   fun:g_test_create_suite
+}
+{
+   glib/gtestsuiteadd
+   Memcheck:Leak
+   ...
+   fun:g_test_suite_add
+}
+{
+   glib/gtestsuiteaddsuite
+   Memcheck:Leak
+   ...
+   fun:g_test_suite_add_suite
+}
+{
+   glib/gtestsuiterun
+   Memcheck:Leak
+   ...
+   fun:g_slist_copy
+   fun:g_test_run_suite_internal
+}
+{
+   glib/gthreadpool
+   Memcheck:Leak
+   ...
+   fun:g_thread_pool_start_thread
+}
+{
+   glib/gthreadpool1
+   Memcheck:Leak
+   ...
+   fun:g_thread_pool_wait_for_new_pool
+}
+{
+   glib/gthreadpool2
+   Memcheck:Leak
+   ...
+   fun:g_thread_pool_wait_for_new_task
+}
+{
+   glib/gthreadtls
+   Memcheck:Leak
+   ...
+   fun:_dl_allocate_tls
+   ...
+   fun:g_thread_create_posix_impl
+}
 
+# probably inlines the aggressive memcpy/memcmp
+{
+   gnutls/der
+   Memcheck:Cond
+   ...
+   fun:asn1_der_coding
+}
 # probably using uninitialized memory as padding or something
 {
    gnutls/handshake
@@ -213,6 +332,12 @@
    fun:xmlInitParser
 }
 {
+   libxml2/xmlInitParserCtxt
+   Memcheck:Leak
+   ...
+   fun:xmlInitParserCtxt
+}
+{
    libxml2/xmlInitializeDict
    Memcheck:Leak
    ...
diff --git a/tests/misc-test.c b/tests/misc-test.c
index 411cb11..f5ecb57 100644
--- a/tests/misc-test.c
+++ b/tests/misc-test.c
@@ -41,6 +41,12 @@ close_socket (SoupMessage *msg, gpointer user_data)
 	SoupSocket *sock = user_data;
 
 	soup_socket_disconnect (sock);
+
+	/* But also add the missing data to the message now, so
+	 * SoupServer can clean up after itself properly.
+	 */
+	soup_message_body_append (msg->response_body, SOUP_MEMORY_STATIC,
+				  "foo", 3);
 }
 
 static void
@@ -1041,6 +1047,7 @@ main (int argc, char **argv)
 
 	soup_uri_free (base_uri);
 	soup_test_server_quit_unref (server);
+	g_mutex_free (server_mutex);
 
 	test_cleanup ();
 	return errors != 0;
diff --git a/tests/requester-test.c b/tests/requester-test.c
index d303865..2c578af 100644
--- a/tests/requester-test.c
+++ b/tests/requester-test.c
@@ -98,6 +98,7 @@ test_sent (GObject *source, GAsyncResult *res, gpointer user_data)
 		g_main_loop_quit (loop);
 		return;
 	}
+	g_object_unref (msg);
 
 	g_input_stream_read_async (stream, buf, sizeof (buf),
 				   G_PRIORITY_DEFAULT, NULL,
@@ -161,11 +162,12 @@ do_test_with_context (const char *uri)
 	session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC,
 					 SOUP_SESSION_ASYNC_CONTEXT, async_context,
 					 NULL);
-	g_main_context_unref (async_context);
 
 	do_test_for_thread_and_context (session, uri);
 	soup_test_session_abort_unref (session);
 
+	g_main_context_pop_thread_default (async_context);
+	g_main_context_unref (async_context);
 	return NULL;
 }
 
diff --git a/tests/timeout-test.c b/tests/timeout-test.c
index d3b6279..4cde526 100644
--- a/tests/timeout-test.c
+++ b/tests/timeout-test.c
@@ -135,6 +135,7 @@ do_timeout_tests (char *fast_uri, char *slow_uri)
 					       NULL);
 	do_tests_for_session (timeout_session, NULL, plain_session, fast_uri, slow_uri);
 	soup_test_session_abort_unref (timeout_session);
+	soup_test_session_abort_unref (plain_session);
 }
 
 static gboolean



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]