From d924c842024569e5d1c2f0fa6d2ec6b6c30a3aa0 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sat, 28 Jun 2014 22:11:42 +0200 Subject: [PATCH] httpc: fix the hc == NULL condition in the http_client_thread() --- src/httpc.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/httpc.c b/src/httpc.c index 864c7a64..bf4067dc 100644 --- a/src/httpc.c +++ b/src/httpc.c @@ -1152,12 +1152,14 @@ http_client_thread ( void *p ) TAILQ_FOREACH(hc, &http_clients, hc_link) if (hc == ev.data.ptr) break; - if (hc == NULL || hc->hc_shutdown_wait) { - if (hc->hc_shutdown_wait) { - pthread_cond_broadcast(&http_cond); - /* Disable the poll looping for this moment */ - http_client_poll_dir(hc, 0, 0); - } + if (hc == NULL) { + pthread_mutex_unlock(&http_lock); + continue; + } + if (hc->hc_shutdown_wait) { + pthread_cond_broadcast(&http_cond); + /* Disable the poll looping for this moment */ + http_client_poll_dir(hc, 0, 0); pthread_mutex_unlock(&http_lock); continue; }