From: Jaroslav Kysela Date: Mon, 2 Oct 2017 07:08:39 +0000 (+0200) Subject: htsp: fix the global_lock in htsp_file_destroy, fixes #4622 X-Git-Tag: v4.2.4~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2bc61c904a4edb8bf1525ec72e964535584d9119;p=thirdparty%2Ftvheadend.git htsp: fix the global_lock in htsp_file_destroy, fixes #4622 --- diff --git a/src/htsp_server.c b/src/htsp_server.c index 6e1e71aa6..6105fb4ed 100644 --- a/src/htsp_server.c +++ b/src/htsp_server.c @@ -780,8 +780,11 @@ htsp_file_destroy(htsp_file_t *hf) { tvhdebug(LS_HTSP, "Closed opened file %s", hf->hf_path); LIST_REMOVE(hf, hf_link); - if (hf->hf_subscription) + if (hf->hf_subscription) { + pthread_mutex_lock(&global_lock); subscription_unsubscribe(hf->hf_subscription, UNSUBSCRIBE_FINAL); + pthread_mutex_unlock(&global_lock); + } free(hf->hf_path); close(hf->hf_fd); free(hf); @@ -2854,7 +2857,9 @@ htsp_method_file_close(htsp_connection_t *htsp, htsmsg_t *in) dvr_entry_changed_notify(de); } + pthread_mutex_unlock(&global_lock); htsp_file_destroy(hf); + pthread_mutex_lock(&global_lock); return htsmsg_create_map(); }