]> 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:47 +0000 (09:09 +0200)
src/htsp_server.c

index 1868d60b744ba7a7e16e03a49aacfd6d5c7ea08b..018f64b5e191cf476dc075f4b3f687f42bb77ac6 100644 (file)
@@ -784,8 +784,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);
@@ -2869,7 +2872,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();
 }