capmt: fix wrong free() call

This commit is contained in:
Jaroslav Kysela 2014-06-10 13:37:04 +02:00
parent 2a4d765e1c
commit 2be0f84f0f

View 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);
}