]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
profile: try to fix SIGSEGV
authorJaroslav Kysela <perex@perex.cz>
Sun, 14 Jan 2018 21:18:52 +0000 (22:18 +0100)
committerJaroslav Kysela <perex@perex.cz>
Sun, 14 Jan 2018 21:18:52 +0000 (22:18 +0100)
src/profile.c

index b2ba5111939c1353987c4d8ace20472e775296d8..d8db344f5f7e8bcc263f374e3c04cdb816ff6282 100644 (file)
@@ -952,13 +952,14 @@ profile_sharer_destroy(profile_chain_t *prch)
 {
   profile_sharer_t *prsh = prch->prch_sharer;
   profile_sharer_message_t *psm, *psm2;
+  int run;
 
   if (prsh == NULL)
     return;
   pthread_mutex_lock(&prsh->prsh_queue_mutex);
   LIST_REMOVE(prch, prch_sharer_link);
   if (LIST_EMPTY(&prsh->prsh_chains)) {
-    if (prsh->prsh_queue_run) {
+    if ((run = prsh->prsh_queue_run) != 0) {
       prsh->prsh_queue_run = 0;
       tvh_cond_signal(&prsh->prsh_queue_cond, 0);
     }
@@ -966,7 +967,7 @@ profile_sharer_destroy(profile_chain_t *prch)
     prch->prch_post_share = NULL;
   }
   pthread_mutex_unlock(&prsh->prsh_queue_mutex);
-  if (prch->prch_sharer == NULL) {
+  if (run) {
     pthread_join(prsh->prsh_queue_thread, NULL);
     while ((psm = TAILQ_FIRST(&prsh->prsh_queue)) != NULL) {
       streaming_msg_free(psm->psm_sm);