fix 'use after free' of the htsp logname when the connection to the client is lost.

This commit is contained in:
John Törnblom 2012-11-14 11:00:50 +01:00
parent fcaf92e1ab
commit fd6f813d83

View file

@ -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) {