From: Jaroslav Kysela Date: Tue, 10 Jun 2014 11:37:04 +0000 (+0200) Subject: capmt: fix wrong free() call X-Git-Tag: v4.1~1954 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2be0f84f0f7127d0a85217cad339a1b472b074c9;p=thirdparty%2Ftvheadend.git capmt: fix wrong free() call --- diff --git a/src/descrambler/capmt.c b/src/descrambler/capmt.c index cdee0a2e7..3bfd701a8 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); }