]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
capmt: fix wrong free() call
authorJaroslav Kysela <perex@perex.cz>
Tue, 10 Jun 2014 11:37:04 +0000 (13:37 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 10 Jun 2014 12:02:37 +0000 (14:02 +0200)
src/descrambler/capmt.c

index cdee0a2e7dc58d2d847abbc9243bbbb277472263..3bfd701a8957d1ff27f0f9fd941d5d37402d0215 100644 (file)
@@ -1399,6 +1399,8 @@ capmt_thread(void *aux)
 
   capmt_flush_queue(capmt, 1);
   free(capmt->capmt_id);
+  free(capmt->capmt_sockfile);
+  free(capmt->capmt_comment);
   free(capmt);
 
   return NULL;
@@ -1781,16 +1783,12 @@ capmt_destroy(capmt_t *capmt)
   TAILQ_REMOVE(&capmts, capmt, capmt_link);  
   capmt->capmt_running = 0;
   pthread_cond_signal(&capmt->capmt_cond);
-  pthread_mutex_unlock(&global_lock);
-  pthread_join(capmt->capmt_tid, NULL);
-  free(capmt->capmt_sockfile);
-  capmt->capmt_sockfile = NULL;
-  free(capmt->capmt_comment);
-  capmt->capmt_comment = NULL;
   tvhlog(LOG_INFO, "capmt", "mode %i %s %s port %i destroyed",
          capmt->capmt_oscam,
          capmt->capmt_oscam == CAPMT_OSCAM_TCP ? "IP address" : "sockfile",
          capmt->capmt_sockfile, capmt->capmt_port);
+  pthread_mutex_unlock(&global_lock);
+  pthread_join(capmt->capmt_tid, NULL);
   pthread_mutex_lock(&global_lock);
 }