From: Dan Winship Date: Mon, 22 May 2006 14:47:30 +0000 (+0000) Subject: Don't free the hosts while holding host_lock; that's not allowed and can X-Git-Tag: LIBSOUP_2_2_93~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fd265d01dbd577b361f895aac6b6c073e47fe1e7;p=platform%2Fupstream%2Flibsoup.git Don't free the hosts while holding host_lock; that's not allowed and can * libsoup/soup-session.c (cleanup_hosts): Don't free the hosts while holding host_lock; that's not allowed and can cause deadlock. #309867. Based on a patch from Veerapuram Varadhan for part of bnc #174255. --- diff --git a/ChangeLog b/ChangeLog index c444f73..e5f4757 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-05-22 Dan Winship + + * libsoup/soup-session.c (cleanup_hosts): Don't free the hosts + while holding host_lock; that's not allowed and can cause + deadlock. #309867. Based on a patch from Veerapuram Varadhan for + part of bnc #174255. + 2006-04-10 Dan Winship * configure.in: bump version to 2.2.92 diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c index 95594b8..480e618 100644 --- a/libsoup/soup-session.c +++ b/libsoup/soup-session.c @@ -139,9 +139,15 @@ foreach_free_host (gpointer key, gpointer host, gpointer data) static void cleanup_hosts (SoupSessionPrivate *priv) { + GHashTable *old_hosts; + g_mutex_lock (priv->host_lock); - g_hash_table_foreach_remove (priv->hosts, foreach_free_host, NULL); + old_hosts = priv->hosts; + priv->hosts = g_hash_table_new (host_uri_hash, host_uri_equal); g_mutex_unlock (priv->host_lock); + + g_hash_table_foreach_remove (old_hosts, foreach_free_host, NULL); + g_hash_table_destroy (old_hosts); } static void