From 49985fee805aa6d2020bfe5121b589b2b5919509 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 17 Jun 2014 18:09:27 +0200 Subject: [PATCH] capmt: fix the shutdown/free sequence --- src/descrambler/capmt.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/descrambler/capmt.c b/src/descrambler/capmt.c index e2c36c0c..058615bf 100644 --- a/src/descrambler/capmt.c +++ b/src/descrambler/capmt.c @@ -1443,11 +1443,6 @@ 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; } @@ -1836,15 +1831,19 @@ capmt_destroy(capmt_t *capmt) { lock_assert(&global_lock); TAILQ_REMOVE(&capmts, capmt, capmt_link); - 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); capmt->capmt_running = 0; pthread_cond_broadcast(&capmt->capmt_cond); pthread_mutex_unlock(&global_lock); pthread_join(capmt->capmt_tid, NULL); pthread_mutex_lock(&global_lock); + 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); + free(capmt->capmt_id); + free(capmt->capmt_sockfile); + free(capmt->capmt_comment); + free(capmt); } /**