From: Dennis Schafroth Date: Tue, 1 Mar 2011 12:47:01 +0000 (+0100) Subject: Counting the right places. Destroying nmem and wrbuf attached to http_channel X-Git-Tag: v1.5.5~32 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;h=8df7977676dd0909eceba9bc2a82c4e9523b1bed;p=pazpar2-moved-to-github.git Counting the right places. Destroying nmem and wrbuf attached to http_channel --- diff --git a/src/http.c b/src/http.c index 3ac922d..7c69871 100644 --- a/src/http.c +++ b/src/http.c @@ -1115,7 +1115,9 @@ static void http_channel_destroy(IOCHAN i) yaz_mutex_enter(s->http_server->mutex); if (s->http_server->http_channel_freelist_max > 0 && s->http_server->http_channel_freelist_count > s->http_server->http_channel_freelist_max) { - while (s->next = s->http_server->http_channel_freelist) { + while ((s->next = s->http_server->http_channel_freelist)) { + nmem_destroy(s->next->nmem); + wrbuf_destroy(s->next->wrbuf); xfree(s->next); s->http_server->http_channel_freelist = s->http_server->http_channel_freelist->next; } @@ -1123,6 +1125,7 @@ static void http_channel_destroy(IOCHAN i) else { s->next = s->http_server->http_channel_freelist; s->http_server->http_channel_freelist = s; + s->http_server->http_channel_freelist_count++; } yaz_mutex_leave(s->http_server->mutex); @@ -1146,7 +1149,7 @@ static struct http_channel *http_channel_create(http_server_t hs, r = hs->http_channel_freelist; if (r) { hs->http_channel_freelist = r->next; - hs->http_channel_freelist_count++; + hs->http_channel_freelist_count--; } yaz_mutex_leave(hs->mutex);