diff options
author | Dan Winship <danw@gnome.org> | 2010-03-13 11:57:09 -0500 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2010-03-13 11:57:09 -0500 |
commit | d08ed91a7da4bd25180d6ddf19500f2a7b729c6d (patch) | |
tree | 1c770d1ef2822ccd7edfc28a723eda14d01afb11 /libsoup | |
parent | e69be10e1b99723460d9aca45a53cbbd6f2b5673 (diff) | |
download | libsoup-d08ed91a7da4bd25180d6ddf19500f2a7b729c6d.tar.gz |
Fix leaks found by valgrind
Also, simply the suppressions file by using the "..." syntax, which I
think didn't exist (or at least wasn't documented) when I first
created it.
Diffstat (limited to 'libsoup')
-rw-r--r-- | libsoup/soup-address.c | 2 | ||||
-rw-r--r-- | libsoup/soup-content-decoder.c | 18 | ||||
-rw-r--r-- | libsoup/soup-gnutls.c | 5 | ||||
-rw-r--r-- | libsoup/soup-session.c | 4 |
4 files changed, 27 insertions, 2 deletions
diff --git a/libsoup/soup-address.c b/libsoup/soup-address.c index b7e07a0c..605a51bd 100644 --- a/libsoup/soup-address.c +++ b/libsoup/soup-address.c @@ -612,7 +612,7 @@ complete_resolve_async (SoupAddress *addr, guint status) } g_slice_free (SoupAddressResolveAsyncData, res_data); } - g_slist_free (l); + g_slist_free (lookups); g_object_unref (addr); } diff --git a/libsoup/soup-content-decoder.c b/libsoup/soup-content-decoder.c index a460c507..24ea7518 100644 --- a/libsoup/soup-content-decoder.c +++ b/libsoup/soup-content-decoder.c @@ -58,6 +58,8 @@ static void soup_content_decoder_session_feature_init (SoupSessionFeatureInterfa static void request_queued (SoupSessionFeature *feature, SoupSession *session, SoupMessage *msg); static void request_unqueued (SoupSessionFeature *feature, SoupSession *session, SoupMessage *msg); +static void finalize (GObject *object); + G_DEFINE_TYPE_WITH_CODE (SoupContentDecoder, soup_content_decoder, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (SOUP_TYPE_SESSION_FEATURE, soup_content_decoder_session_feature_init)) @@ -83,7 +85,11 @@ soup_content_decoder_init (SoupContentDecoder *decoder) static void soup_content_decoder_class_init (SoupContentDecoderClass *decoder_class) { - g_type_class_add_private (decoder_class, sizeof (SoupContentDecoderPrivate)); + GObjectClass *object_class = G_OBJECT_CLASS (decoder_class); + + g_type_class_add_private (decoder_class, sizeof (SoupContentDecoderPrivate)); + + object_class->finalize = finalize; } static void @@ -95,6 +101,16 @@ soup_content_decoder_session_feature_init (SoupSessionFeatureInterface *feature_ } static void +finalize (GObject *object) +{ + SoupContentDecoder *decoder = SOUP_CONTENT_DECODER (object); + + g_hash_table_destroy (decoder->priv->codings); + + G_OBJECT_CLASS (soup_content_decoder_parent_class)->finalize (object); +} + +static void soup_content_decoder_got_headers_cb (SoupMessage *msg, SoupContentDecoder *decoder) { SoupMessagePrivate *msgpriv = SOUP_MESSAGE_GET_PRIVATE (msg); diff --git a/libsoup/soup-gnutls.c b/libsoup/soup-gnutls.c index 1b6e613e..ac22d952 100644 --- a/libsoup/soup-gnutls.c +++ b/libsoup/soup-gnutls.c @@ -112,6 +112,7 @@ verify_certificate (gnutls_session session, const char *hostname, GError **err) session, &cert_list_size); if (cert_list == NULL) { + gnutls_x509_crt_deinit (cert); g_set_error (err, SOUP_SSL_ERROR, SOUP_SSL_ERROR_CERTIFICATE, "No SSL certificate was found."); @@ -120,6 +121,7 @@ verify_certificate (gnutls_session session, const char *hostname, GError **err) if (gnutls_x509_crt_import (cert, &cert_list[0], GNUTLS_X509_FMT_DER) < 0) { + gnutls_x509_crt_deinit (cert); g_set_error (err, SOUP_SSL_ERROR, SOUP_SSL_ERROR_CERTIFICATE, "The SSL certificate could not be parsed."); @@ -127,11 +129,14 @@ verify_certificate (gnutls_session session, const char *hostname, GError **err) } if (!gnutls_x509_crt_check_hostname (cert, hostname)) { + gnutls_x509_crt_deinit (cert); g_set_error (err, SOUP_SSL_ERROR, SOUP_SSL_ERROR_CERTIFICATE, "The SSL certificate does not match the hostname."); return FALSE; } + + gnutls_x509_crt_deinit (cert); } return TRUE; diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c index 009d702f..59342e93 100644 --- a/libsoup/soup-session.c +++ b/libsoup/soup-session.c @@ -226,6 +226,8 @@ finalize (GObject *object) g_free (priv->user_agent); g_free (priv->accept_language); + if (priv->ssl_ca_file) + g_free (priv->ssl_ca_file); if (priv->ssl_creds) soup_ssl_free_client_credentials (priv->ssl_creds); @@ -1145,6 +1147,8 @@ redirect_handler (SoupMessage *msg, gpointer user_data) */ new_uri = soup_uri_new_with_base (soup_message_get_uri (msg), new_loc); if (!new_uri || !new_uri->host) { + if (new_uri) + soup_uri_free (new_uri); soup_message_set_status_full (msg, SOUP_STATUS_MALFORMED, "Invalid Redirect URL"); |