don't leak the SoupAddress.
authorDan Winship <danw@src.gnome.org>
Wed, 21 Nov 2007 03:51:24 +0000 (03:51 +0000)
committerDan Winship <danw@src.gnome.org>
Wed, 21 Nov 2007 03:51:24 +0000 (03:51 +0000)
* libsoup/soup-connection.c (soup_connection_connect_async): don't
leak the SoupAddress.

* libsoup/soup-dns.c (soup_dns_lookup_resolve_async): fix a leak
when re-looking up an address

* libsoup/soup-session.c (soup_session_abort): close all
connections in addition to cancelling messages (needed because
connections currently end up holding a ref on their session,
preventing them from being destroyed).

* tests/auth-test.c:
* tests/ntlm-test.c:
* tests/proxy-test.c:
* tests/pull-api.c:
* tests/ssl-test.c:
* tests/xmlrpc-test.c: clean up more memory on exit, to help find
leaks in the library

* tests/libsoup.supp: add a zillion new suppressions so we
can use --leak-resolution=med

svn path=/trunk/; revision=953

ChangeLog
libsoup/soup-connection.c
libsoup/soup-dns.c
libsoup/soup-session.c
tests/auth-test.c
tests/libsoup.supp
tests/ntlm-test.c
tests/proxy-test.c
tests/pull-api.c
tests/ssl-test.c
tests/xmlrpc-test.c

index b0168c8..d2874c9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2007-11-20  Dan Winship  <danw@gnome.org>
+
+       * libsoup/soup-connection.c (soup_connection_connect_async): don't
+       leak the SoupAddress.
+
+       * libsoup/soup-dns.c (soup_dns_lookup_resolve_async): fix a leak
+       when re-looking up an address
+
+       * libsoup/soup-session.c (soup_session_abort): close all
+       connections in addition to cancelling messages (needed because
+       connections currently end up holding a ref on their session,
+       preventing them from being destroyed).
+
+       * tests/auth-test.c:
+       * tests/ntlm-test.c:
+       * tests/proxy-test.c:
+       * tests/pull-api.c:
+       * tests/ssl-test.c:
+       * tests/xmlrpc-test.c: clean up more memory on exit, to help find
+       leaks in the library
+
+       * tests/libsoup.supp: add a zillion new suppressions so we
+       can use --leak-resolution=med
+
 2007-11-16  Dan Winship  <danw@gnome.org>
 
        * libsoup/soup-message-io.c (read_body_chunk): Fix the guards
index eeedf9d..f3c3270 100644 (file)
@@ -555,6 +555,7 @@ soup_connection_connect_async (SoupConnection *conn,
                               gpointer user_data)
 {
        SoupConnectionPrivate *priv;
+       SoupAddress *addr;
 
        g_return_if_fail (SOUP_IS_CONNECTION (conn));
        priv = SOUP_CONNECTION_GET_PRIVATE (conn);
@@ -565,16 +566,19 @@ soup_connection_connect_async (SoupConnection *conn,
                                          G_CALLBACK (callback), user_data);
        }
 
+       addr = soup_address_new (priv->conn_uri->host, priv->conn_uri->port);
+
        priv->socket =
                soup_socket_new (SOUP_SOCKET_SSL_CREDENTIALS, priv->ssl_creds,
                                 SOUP_SOCKET_ASYNC_CONTEXT, priv->async_context,
                                 NULL);
-       soup_socket_connect (priv->socket, soup_address_new (priv->conn_uri->host,
-                                                            priv->conn_uri->port));
+       soup_socket_connect (priv->socket, addr);
        soup_signal_connect_once (priv->socket, "connect_result",
                                  G_CALLBACK (socket_connect_result), conn);
        g_signal_connect (priv->socket, "disconnected",
                          G_CALLBACK (socket_disconnected), conn);
+
+       g_object_unref (addr);
 }
 
 /**
index bcb0a3b..6ab3f4f 100644 (file)
@@ -571,9 +571,9 @@ soup_dns_lookup_resolve_async (SoupDNSLookup *lookup, GMainContext *async_contex
        lookup->callback = callback;
        lookup->user_data = user_data;
        lookup->running = TRUE;
-       entry->lookups = g_slist_prepend (entry->lookups, lookup);
 
        if (!entry->resolved) {
+               entry->lookups = g_slist_prepend (entry->lookups, lookup);
                if (!entry->resolver_thread) {
                        soup_dns_cache_entry_ref (entry);
                        entry->resolver_thread =
index 018b521..ae8da80 100644 (file)
@@ -1347,6 +1347,15 @@ soup_session_cancel_message (SoupSession *session, SoupMessage *msg)
        SOUP_SESSION_GET_CLASS (session)->cancel_message (session, msg);
 }
 
+static void
+gather_conns (gpointer key, gpointer host, gpointer data)
+{
+       SoupConnection *conn = key;
+       GSList **conns = data;
+
+       *conns = g_slist_prepend (*conns, conn);
+}
+
 /**
  * soup_session_abort:
  * @session: the session
@@ -1356,13 +1365,31 @@ soup_session_cancel_message (SoupSession *session, SoupMessage *msg)
 void
 soup_session_abort (SoupSession *session)
 {
+       SoupSessionPrivate *priv;
        SoupMessageQueueIter iter;
        SoupMessage *msg;
+       GSList *conns, *c;
 
        g_return_if_fail (SOUP_IS_SESSION (session));
+       priv = SOUP_SESSION_GET_PRIVATE (session);
 
        for (msg = soup_message_queue_first (session->queue, &iter); msg; msg = soup_message_queue_next (session->queue, &iter)) {
                soup_message_set_status (msg, SOUP_STATUS_CANCELLED);
                soup_session_cancel_message (session, msg);
        }
+
+       /* Close all connections */
+       g_mutex_lock (priv->host_lock);
+       conns = NULL;
+       g_hash_table_foreach (priv->conns, gather_conns, &conns);
+
+       for (c = conns; c; c = c->next)
+               g_object_ref (c->data);
+       g_mutex_unlock (priv->host_lock);
+       for (c = conns; c; c = c->next) {
+               soup_connection_disconnect (c->data);
+               g_object_unref (c->data);
+       }
+
+       g_slist_free (conns);
 }
index 499c95c..cf4473d 100644 (file)
@@ -416,6 +416,8 @@ main (int argc, char **argv)
 
        loop = g_main_loop_new (NULL, TRUE);
        g_main_loop_run (loop);
+       g_main_loop_unref (loop);
+       g_main_context_unref (g_main_context_default ());
 
        soup_session_abort (session);
        g_object_unref (session);
index a81441f..a747063 100644 (file)
 # valgrind suppressions file
 
 {
-  glib/gtype
-  Memcheck:Leak
-  fun:calloc
-  fun:g_malloc0
-  obj:*
-  obj:*
-  fun:g_type_init_with_debug_flags
+   glib/quark1
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_slice_alloc
+   fun:g_hash_node_new
+   fun:g_hash_table_insert
+   fun:g_quark_from_static_string
 }
 {
-   glib/gtype2
+   glib/quark2
    Memcheck:Leak
    fun:malloc
    fun:realloc
    fun:g_realloc
    fun:g_quark_from_static_string
+}
+{
+   glib/quark3
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_slice_alloc
+   fun:g_hash_table_new_full
+   fun:g_quark_from_static_string
+}
+{
+   glib/quark4
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_strdup
+   fun:g_quark_from_string
+}
+{
+   glib/quark5
+   Memcheck:Leak
+   fun:malloc
+   fun:realloc
+   fun:g_realloc
+   fun:g_quark_from_string
+}
+{
+   glib/quark6
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_slice_alloc
+   fun:g_hash_node_new
+   fun:g_hash_table_insert
+   fun:g_quark_from_string
+}
+{
+   glib/quark7
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:g_hash_table_new_full
+   fun:g_quark_from_string
+}
+{
+   glib/quark8
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_slice_alloc
+   fun:g_hash_table_new_full
+   fun:g_quark_from_string
+}
+{
+   glib/quark9
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:g_hash_table_resize
+   fun:g_quark_from_string
+}
+{
+   glib/typeinit1
+   Memcheck:Leak
+   fun:realloc
+   fun:g_realloc
+   fun:g_value_register_transform_func
+   fun:g_type_init_with_debug_flags
+}
+{
+   glib/typeinit2
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:type_data_make_W
+   fun:g_type_init_with_debug_flags
+}
+{
+   glib/typeinit3
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:type_node_any_new_W
+   fun:type_node_fundamental_new_W
    fun:g_type_init_with_debug_flags
 }
 {
-   glib/gtype3
+   glib/property
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_slice_alloc
+   fun:g_slist_prepend
+   fun:g_object_class_install_property
+}
+{
+   glib/gparamtypes1
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:g_param_spec_types_init
+}
+{
+   glib/paramtypes2
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_param_type_register_static
+   fun:g_param_spec_types_init
+}
+{
+   glib/paramtypes3
    Memcheck:Leak
    fun:realloc
    fun:g_realloc
    fun:g_boxed_type_register_static
    fun:g_value_array_get_type
-   obj:/lib64/libgobject-2.0.so.0.1200.13
-   fun:g_type_init_with_debug_flags
+   fun:g_param_spec_types_init
+}
+{
+   glib/typereg1
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:type_data_make_W
+   fun:g_type_register_static
+}
+{
+   glib/typereg2
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:type_add_flags_W
+   fun:g_type_register_static
+}
+{
+   glib/typereg3
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:g_hash_table_resize
+   fun:type_node_any_new_W
+   fun:g_type_register_static
+}
+{
+   glib/typereg4
+   Memcheck:Leak
+   fun:realloc
+   fun:g_realloc0
+   fun:type_node_any_new_W
+   fun:g_type_register_static
+}
+{
+   glib/typereg5
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:type_node_any_new_W
+   fun:g_type_register_static
+}
+{
+   glib/typereg6
+   Memcheck:Leak
+   fun:realloc
+   fun:g_realloc
+   fun:type_node_any_new_W
+   fun:g_type_register_static
+}
+{
+   glib/typereg7
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_memdup
+   fun:type_node_any_new_W
+   fun:g_type_register_static
+}
+{
+   glib/typereg8
+   Memcheck:Leak
+   fun:malloc
+   fun:realloc
+   fun:g_realloc
+   fun:type_node_any_new_W
+   fun:g_type_register_static
+}
+{
+   glib/typeregf1
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:type_data_make_W
+   fun:g_type_register_fundamental
+}
+{
+   glib/typeregf2
+   Memcheck:Leak
+   fun:malloc
+   fun:realloc
+   fun:g_realloc
+   fun:type_add_flags_W
+   fun:g_type_register_fundamental
 }
 {
-   glib/gtype4
+   glib/typeregf3
    Memcheck:Leak
    fun:calloc
    fun:g_malloc0
-   obj:*libglib-2.0*
+   fun:type_add_flags_W
+   fun:g_type_register_fundamental
+}
+{
+   glib/interface1
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:type_add_interface_Wm
+   fun:g_type_add_interface_static
+}
+{
+   glib/interface2
+   Memcheck:Leak
+   fun:realloc
+   fun:g_realloc
+   fun:type_add_interface_Wm
+   fun:g_type_add_interface_static
+}
+{
+   glib/interface3
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_memdup
+   fun:type_add_interface_Wm
+   fun:g_type_add_interface_static
+}
+{
+   glib/interface4
+   Memcheck:Leak
+   fun:malloc
+   fun:realloc
+   fun:g_realloc
+   fun:type_node_add_iface_entry_W
+   fun:type_add_interface_Wm
+   fun:g_type_add_interface_static
+}
+{
+   glib/paramspec1
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
    fun:g_slice_alloc
-   fun:g_hash_table_new_full
-   fun:g_quark_from_static_string
-   fun:g_type_init_with_debug_flags
+   fun:g_slice_alloc0
+   fun:g_type_create_instance
+   fun:g_param_spec_internal
 }
 {
-   glib/gtype5
+   glib/paramspec2
    Memcheck:Leak
    fun:malloc
    fun:g_malloc
+   fun:g_strdup
+   fun:g_param_spec_internal
+}
+{
+   glib/signalinit
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
    fun:g_hash_table_new_full
-   fun:g_quark_from_static_string
-   fun:g_type_init_with_debug_flags
+   fun:g_signal_init
+}
+{
+   glib/signal1
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_signal_newv
+   fun:g_signal_new_valist
+}
+{
+   glib/signal2
+   Memcheck:Leak
+   fun:realloc
+   fun:g_realloc
+   fun:g_signal_newv
+   fun:g_signal_new_valist
+}
+{
+   glib/signal3
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:g_closure_new_simple
+   fun:g_signal_type_cclosure_new
+   fun:g_signal_new
+}
+{
+   glib/signal4
+   Memcheck:Leak
+   fun:realloc
+   fun:g_realloc
+   fun:signal_add_class_closure
+   fun:g_signal_newv
+   fun:g_signal_new_valist
+   fun:g_signal_new
+}
+{
+   glib/signal5
+   Memcheck:Leak
+   fun:malloc
+   fun:realloc
+   fun:g_realloc
+   fun:g_closure_set_meta_marshal
+   fun:g_signal_type_cclosure_new
+   fun:g_signal_new
+}
+{
+   glib/signal7
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_memdup
+   fun:g_signal_newv
 }
 {
    glib/gslice
    fun:g_slice_init_nomessage
 }
 {
+   glib/typeref1
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:g_type_class_ref
+   fun:g_object_newv
+}
+{
+   glib/typeref2
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:g_type_class_ref
+   fun:g_object_new_valist
+}
+{
+   glib/typeref3
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:g_type_class_ref
+   fun:g_type_create_instance
+}
+{
+   glib/typeref4
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:g_type_class_ref
+   fun:g_type_class_ref
+}
+{
+   glib/typeref5
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:g_hash_table_new_full
+   fun:g_param_spec_pool_new
+   fun:g_object_do_class_init
+   fun:g_type_class_ref
+}
+{
+   glib/typeref6
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_param_spec_pool_new
+   fun:g_object_do_class_init
+   fun:g_type_class_ref
+}
+{
+   glib/typeref7
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:type_iface_ensure_dflt_vtable_Wm
+   fun:type_iface_vtable_base_init_Wm
+   fun:g_type_class_ref
+}
+{
+   glib/typeref8
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_memdup
+   fun:type_iface_vtable_base_init_Wm
+   fun:g_type_class_ref
+}
+{
+   glib/typeref9
+   Memcheck:Leak
+   fun:malloc
+   fun:realloc
+   fun:g_realloc
+   fun:g_type_add_interface_check
+   fun:g_type_class_ref
+}
+{
+   glib/typeref10
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_slice_alloc
+   fun:g_slist_copy
+   fun:g_object_base_class_init
+   fun:g_type_class_ref
+}
+{
+   glib/langnames1
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_strdup
+   fun:g_get_language_names
+   fun:main
+}
+{
+   glib/langnames2
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:g_hash_table_resize
+   fun:g_get_language_names
+   fun:main
+}
+{
+   glib/langnames3
+   Memcheck:Leak
+   fun:realloc
+   fun:g_realloc
+   fun:g_array_maybe_expand
+   fun:g_array_set_size
+   fun:g_static_private_set
+   fun:g_get_language_names
+   fun:main
+}
+{
+   glib/langnames4
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_get_language_names
+   fun:main
+}
+{
+   glib/langnames5
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_strconcat
+   fun:_g_compute_locale_variants
+   fun:g_get_language_names
+   fun:main
+}
+{
+   glib/langnames6
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:g_get_language_names
+   fun:main
+}
+{
    glib/intern1
    Memcheck:Leak
    fun:malloc
    fun:g_realloc
    fun:g_intern_string
 }
+{
+   glib/intern3
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:g_hash_table_resize
+   fun:g_intern_static_string
+}
+{
+   glib/gthreadinit1
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:g_thread_self
+   fun:g_thread_init_glib
+}
+{
+   glib/gthreadinit2
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_cond_new_posix_impl
+   fun:g_thread_init_glib
+}
+{
+   glib/gthreadinit3
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_mutex_new_posix_impl
+   fun:g_thread_init_glib
+}
+{
+   glib/gthreadinit4
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_mutex_new_posix_impl
+   fun:_g_mem_thread_init_noprivate_nomessage
+   fun:g_thread_init_glib
+}
+{
+   glib/gthreadinit5
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_mutex_new_posix_impl
+   fun:_g_slice_thread_init_nomessage
+   fun:g_thread_init_glib
+}
+{
+   glib/gthreadinit6
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_mutex_new_posix_impl
+   fun:_g_slice_thread_init_nomessage
+   fun:g_thread_init_glib
+}
+{
+   glib/gthreadinit7
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_mutex_new_posix_impl
+   fun:_g_messages_thread_init_nomessage
+   fun:g_thread_init_glib
+}
+{
+   glib/gthreadinit8
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:g_get_filename_charsets
+   fun:_g_convert_thread_init
+   fun:g_thread_init_glib
+}
+{
+   glib/gthreadinit9
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_slice_alloc
+   fun:g_array_sized_new
+   fun:g_static_private_set
+   fun:g_get_filename_charsets
+   fun:_g_convert_thread_init
+   fun:g_thread_init_glib
+}
+{
+   glib/gthreadinit10
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:g_get_charset
+   fun:g_get_filename_charsets
+   fun:_g_convert_thread_init
+   fun:g_thread_init_glib
+}
+{
+   glib/threadinit11
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_strdup
+   fun:g_get_charset
+   fun:g_get_filename_charsets
+   fun:_g_convert_thread_init
+   fun:g_thread_init_glib
+}
+{
+   glib/threadinit12
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_strdup
+   fun:g_get_charset
+   fun:g_get_filename_charsets
+   fun:_g_convert_thread_init
+   fun:g_thread_init_glib
+}
+{
+   glib/threadinit13
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_strdup
+   fun:g_get_filename_charsets
+   fun:_g_convert_thread_init
+   fun:g_thread_init_glib
+}
+{
+   glib/threadinit14
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_strdup
+   fun:g_get_filename_charsets
+   fun:_g_convert_thread_init
+   fun:g_thread_init_glib
+}
+{
+   glib/threadinit15
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_private_new_posix_impl
+   fun:g_thread_init_glib
+}
+{
+   glib/threadinit16
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_private_new_posix_impl
+   fun:_g_slice_thread_init_nomessage
+   fun:g_thread_init_glib
+}
+{
+   glib/threadinit17
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_private_new_posix_impl
+   fun:_g_messages_thread_init_nomessage
+   fun:g_thread_init_glib
+}
+{
+   glib/gdata
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:g_hash_table_new_full
+   fun:g_data_initialize
+}
+
 
 {
    libxml2/encoding1
    fun:xmlInitGlobals
 }
 {
-   libxml2/parser
+   libxml2/dict
    Memcheck:Leak
    fun:malloc
    fun:xmlNewRMutex
-   obj:*libxml2*
-   fun:xmlDictCreate
-   fun:xmlInitParserCtxt
+   fun:xmlInitializeDict
+}
+{
+   libxml2/memory
+   Memcheck:Leak
+   fun:malloc
+   fun:xmlNewMutex
+   fun:xmlInitMemory
 }
 
 {
+   gnutls/init1
+   Memcheck:Leak
+   fun:malloc
+   fun:gcry_pthread_mutex_init
+   fun:initialize_basics
+   fun:gcry_control
+   fun:gnutls_global_init
+}
+{
+   gnutls/init2
+   Memcheck:Leak
+   fun:malloc
+   fun:gcry_pthread_mutex_init
+   fun:initialize_basics
+   fun:gcry_control
+   fun:gnutls_global_init
+}
+{
+   gnutls/init3
+   Memcheck:Leak
+   fun:malloc
+   fun:gcry_pthread_mutex_init
+   fun:global_init
+   fun:gcry_check_version
+   fun:gnutls_global_init
+}
+{
+   gnutls/init4
+   Memcheck:Leak
+   fun:malloc
+   fun:_asn1_set_value
+   fun:asn1_array2tree
+   fun:gnutls_global_init
+}
+{
+   gnutls/init5
+   Memcheck:Leak
+   fun:malloc
+   fun:gcry_pthread_mutex_init
+   fun:mutex_init
+   fun:_gcry_ath_mutex_lock
+   fun:_gcry_cipher_init
+   fun:global_init
+   fun:gcry_check_version
+   fun:gnutls_global_init
+}
+{
+   gnutls/init6
+   Memcheck:Leak
+   fun:malloc
+   fun:_asn1_set_value
+   fun:_asn1_change_integer_value
+   fun:asn1_array2tree
+   fun:gnutls_global_init
+}
+{
+   gnutls/init7
+   Memcheck:Leak
+   fun:malloc
+   fun:_asn1_set_value
+   fun:_asn1_expand_object_id
+   fun:asn1_array2tree
+   fun:gnutls_global_init
+}
+{
+   gnutls/init8
+   Memcheck:Leak
+   fun:malloc
+   fun:_gcry_malloc
+   fun:gcry_malloc
+   fun:_gcry_module_add
+   fun:gcry_cipher_register_default
+   fun:_gcry_cipher_init
+   fun:global_init
+   fun:gcry_check_version
+   fun:gnutls_global_init
+}
+{
+   gnutls/init9
+   Memcheck:Leak
+   fun:malloc
+   fun:_gcry_malloc
+   fun:gcry_malloc
+   fun:gcry_xmalloc
+   fun:gcry_xcalloc
+   fun:initialize
+   fun:gcry_randomize
+   fun:gc_pseudo_random
+   fun:gnutls_global_init
+}
+{
+   gnutls/init10
+   Memcheck:Leak
+   fun:calloc
+   fun:_asn1_add_node
+   fun:asn1_array2tree
+   fun:gnutls_global_init
+}
+{
+   gnutls/init11
+   Memcheck:Leak
+   fun:malloc
+   fun:strdup
+   fun:_asn1_set_name
+   fun:_asn1_expand_object_id
+   fun:asn1_array2tree
+   fun:gnutls_global_init
+}
+{
+   gnutls/init12
+   Memcheck:Leak
+   fun:malloc
+   fun:_asn1_set_value
+   fun:asn1_array2tree
+   fun:gnutls_global_init
+}
+{
+   gnutls/init13
+   Memcheck:Leak
+   fun:malloc
+   fun:strdup
+   fun:_asn1_set_name
+   fun:asn1_array2tree
+   fun:gnutls_global_init
+}
+{
+   gnutls/init14
+   Memcheck:Leak
+   fun:calloc
+   fun:_asn1_add_node_only
+   fun:_asn1_expand_object_id
+   fun:asn1_array2tree
+   fun:gnutls_global_init
+}
+{
+   gnutls/init15
+   Memcheck:Leak
+   fun:calloc
+   fun:_asn1_add_node
+   fun:asn1_array2tree
+   fun:gnutls_global_init
+}
+
+
+{
    libsoup/headers
    Memcheck:Leak
    fun:malloc
    fun:g_hash_table_new_full
    fun:intern_header_name
 }
+{
+   libsoup/dnscache1
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:g_hash_table_new_full
+   fun:soup_dns_init
+}
+{
+   libsoup/dnscache2
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:soup_dns_cache_entry_new
+   fun:soup_dns_lookup_address
+}
+{
+   libsoup/dnscache3
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:soup_dns_cache_entry_new
+   fun:soup_dns_lookup_name
+}
+{
+   libsoup/dnscache4
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_memdup
+   fun:soup_dns_cache_entry_set_from_phys
+   fun:soup_dns_cache_entry_new
+}
+{
+   libsoup/dnscache5
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_strdup
+   fun:soup_dns_cache_entry_new
+}
+{
+   libsoup/dnscache6
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_memdup
+   fun:resolve_address
+}
+{
+   libsoup/dnscache7
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_strdup
+   fun:soup_dns_lookup_name
+}
+{
+   libsoup/dns1
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_cond_new_posix_impl
+   fun:soup_dns_init
+}
+{
+   libsoup/dns2
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_mutex_new_posix_impl
+   fun:soup_dns_init
+}
index 9d14aa5..30e01da 100644 (file)
@@ -272,6 +272,7 @@ do_message (SoupSession *session, SoupUri *base_uri, const char *path,
        }
        dprintf ("\n");
 
+       g_object_unref (msg);
        return errors;
 }
 
@@ -390,7 +391,11 @@ main (int argc, char **argv)
        errors = do_ntlm_tests (uri);
        soup_uri_free (uri);
 
+       soup_server_quit (server);
+       g_object_unref (server);
        g_main_loop_unref (loop);
+       g_hash_table_destroy (connections);
+       g_main_context_unref (g_main_context_default ());
 
        dprintf ("\n");
        if (errors) {
index b8b3e23..2133db7 100644 (file)
@@ -174,6 +174,7 @@ main (int argc, char **argv)
        }
 
        apache_cleanup ();
+       g_main_context_unref (g_main_context_default ());
 
        dprintf ("\n");
        if (errors) {
index a20fcd0..723cc88 100644 (file)
@@ -58,6 +58,7 @@ get_correct_response (const char *uri)
        correct_response_len = msg->response.length;
        correct_response = g_strndup (msg->response.body, correct_response_len);
 
+       g_object_unref (msg);
        soup_session_abort (session);
        g_object_unref (session);
 }
@@ -568,6 +569,7 @@ main (int argc, char **argv)
        g_free (correct_response);
 
        apache_cleanup ();
+       g_main_context_unref (g_main_context_default ());
 
        dprintf (1, "\n");
        if (errors) {
index 31c3d5c..cdd88bc 100644 (file)
@@ -114,6 +114,7 @@ server_thread (gpointer user_data)
        gnutls_bye (session, GNUTLS_SHUT_WR);
        gnutls_deinit (session);
        close (client);
+       gnutls_certificate_free_credentials (creds);
 
        return NULL;
 }
@@ -147,6 +148,7 @@ async_read (SoupSocket *sock, gpointer user_data)
        if (memcmp (data->writebuf, data->readbuf, BUFSIZE) != 0)
                g_error ("Sync read didn't match write");
 
+       g_free (data);
        g_main_loop_quit (loop);
 }
 
@@ -209,6 +211,7 @@ main (int argc, char **argv)
        struct sockaddr_in sin;
        GThread *server;
        char writebuf[BUFSIZE], readbuf[BUFSIZE];
+       SoupSSLCredentials *creds;
        SoupSocket *sock;
        gsize n, total;
        SoupSocketIOStatus status;
@@ -266,9 +269,9 @@ main (int argc, char **argv)
        port = ntohs (sin.sin_port);
 
        /* Create the client */
+       creds = soup_ssl_get_client_credentials (NULL);
        sock = soup_socket_client_new_sync ("127.0.0.1", port,
-                                           soup_ssl_get_client_credentials (NULL),
-                                           &status);
+                                           creds, &status);
        if (status != SOUP_STATUS_OK) {
                g_error ("Could not create client socket: %s",
                         soup_status_get_phrase (status));
@@ -278,7 +281,7 @@ main (int argc, char **argv)
 
        /* Now spawn server thread */
        server = g_thread_create (server_thread, GINT_TO_POINTER (listener),
-                                 FALSE, NULL);
+                                 TRUE, NULL);
 
        /* Synchronous client test */
        for (i = 0; i < BUFSIZE; i++)
@@ -316,9 +319,15 @@ main (int argc, char **argv)
        g_idle_add (start_writing, sock);
        loop = g_main_loop_new (NULL, TRUE);
        g_main_loop_run (loop);
+       g_main_loop_unref (loop);
+       g_main_context_unref (g_main_context_default ());
 
        printf ("ASYNCHRONOUS SSL TEST PASSED\n");
 
+       g_object_unref (sock);
+       soup_ssl_free_client_credentials (creds);
+       g_thread_join (server);
+
        /* Success */
        return 0;
 }
index fbfc72f..a77c5b3 100644 (file)
@@ -475,6 +475,9 @@ main (int argc, char **argv)
        if (!test_echo ())
                errors++;
 
+       soup_session_abort (session);
+       g_object_unref (session);
+
        apache_cleanup ();
 
        dprintf (1, "\n");