From: Jaroslav Kysela Date: Wed, 9 Dec 2015 20:20:40 +0000 (+0100) Subject: httpc: hc->hc_efd might be NULL after cond_wait X-Git-Tag: v4.2.1~1328 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c61821700786d75170474c931416cc082f83a9a4;p=thirdparty%2Ftvheadend.git httpc: hc->hc_efd might be NULL after cond_wait --- diff --git a/src/httpc.c b/src/httpc.c index e83367b7c..4b7c428e6 100644 --- a/src/httpc.c +++ b/src/httpc.c @@ -1534,11 +1534,13 @@ http_client_close ( http_client_t *hc ) hc->hc_shutdown_wait = 1; while (hc->hc_running) pthread_cond_wait(&http_cond, &http_lock); - memset(&ev, 0, sizeof(ev)); - ev.fd = hc->hc_fd; - tvhpoll_rem(hc->hc_efd, &ev, 1); - TAILQ_REMOVE(&http_clients, hc, hc_link); - hc->hc_efd = NULL; + if (hc->hc_efd) { + memset(&ev, 0, sizeof(ev)); + ev.fd = hc->hc_fd; + tvhpoll_rem(hc->hc_efd, &ev, 1); + TAILQ_REMOVE(&http_clients, hc, hc_link); + hc->hc_efd = NULL; + } pthread_mutex_unlock(&http_lock); } http_client_shutdown(hc, 1, 0);