From 2be0f84f0f7127d0a85217cad339a1b472b074c9 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 10 Jun 2014 13:37:04 +0200 Subject: [PATCH] capmt: fix wrong free() call --- src/descrambler/capmt.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/descrambler/capmt.c b/src/descrambler/capmt.c index cdee0a2e..3bfd701a 100644 --- a/src/descrambler/capmt.c +++ b/src/descrambler/capmt.c @@ -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); }