From fd6f813d83a8a916d7f8012acf15b49e408a916f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20T=C3=B6rnblom?= Date: Wed, 14 Nov 2012 11:00:50 +0100 Subject: [PATCH] fix 'use after free' of the htsp logname when the connection to the client is lost. --- src/htsp_server.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/htsp_server.c b/src/htsp_server.c index b8c75be4..da8d34bd 100644 --- a/src/htsp_server.c +++ b/src/htsp_server.c @@ -1553,11 +1553,6 @@ htsp_serve(int fd, void *opaque, struct sockaddr_in *source, pthread_mutex_unlock(&global_lock); - free(htsp.htsp_logname); - free(htsp.htsp_peername); - free(htsp.htsp_username); - free(htsp.htsp_clientname); - pthread_mutex_lock(&htsp.htsp_out_mutex); htsp.htsp_writer_run = 0; pthread_cond_signal(&htsp.htsp_out_cond); @@ -1565,6 +1560,11 @@ htsp_serve(int fd, void *opaque, struct sockaddr_in *source, pthread_join(htsp.htsp_writer_thread, NULL); + free(htsp.htsp_logname); + free(htsp.htsp_peername); + free(htsp.htsp_username); + free(htsp.htsp_clientname); + htsp_msg_q_t *hmq; TAILQ_FOREACH(hmq, &htsp.htsp_active_output_queues, hmq_link) {