]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
htsp: fix the global_lock in htsp_file_destroy, fixes #4622
authorJaroslav Kysela <perex@perex.cz>
Mon, 2 Oct 2017 07:08:39 +0000 (09:08 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 2 Oct 2017 07:09:08 +0000 (09:09 +0200)
src/htsp_server.c

index 6e1e71aa65fa6d0265c267152c92f9e2d0f27915..6105fb4edc14c3fc60dcf637dc15ed6d1b4cdbe1 100644 (file)
@@ -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();
 }