HTSP: Plug possible memory leak at HTSP disconnect
If subscriber is slow we will leak memory because buffered packets will not be free'd upon HTSP session close
This commit is contained in:
parent
03f7bc187b
commit
683b0f9c8b
1 changed files with 11 additions and 0 deletions
|
@ -1564,6 +1564,17 @@ htsp_serve(int fd, void *opaque, struct sockaddr_in *source,
|
|||
pthread_mutex_unlock(&htsp.htsp_out_mutex);
|
||||
|
||||
pthread_join(htsp.htsp_writer_thread, NULL);
|
||||
|
||||
htsp_msg_q_t *hmq;
|
||||
|
||||
TAILQ_FOREACH(hmq, &htsp.htsp_active_output_queues, hmq_link) {
|
||||
htsp_msg_t *hm;
|
||||
while((hm = TAILQ_FIRST(&hmq->hmq_q)) != NULL) {
|
||||
TAILQ_REMOVE(&hmq->hmq_q, hm, hm_link);
|
||||
htsp_msg_destroy(hm);
|
||||
}
|
||||
}
|
||||
|
||||
close(fd);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue