From: John Törnblom Date: Wed, 14 Nov 2012 10:00:50 +0000 (+0100) Subject: fix 'use after free' of the htsp logname when the connection to the client is lost. X-Git-Tag: v3.5~293 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd6f813d83a8a916d7f8012acf15b49e408a916f;p=thirdparty%2Ftvheadend.git fix 'use after free' of the htsp logname when the connection to the client is lost. --- diff --git a/src/htsp_server.c b/src/htsp_server.c index b8c75be4c..da8d34bdd 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) {