Skip to content

Commit 28623dc

Browse files
committed
fix: Eliminate memory leak in toxav.
This happens when shutting down a toxav session when it still has some packets in its internal queue. It's not a serious leak and happens very rarely (1 in 300 runs of the toxav_many_test), but it can happen and long-running tox instances that start and end calls a lot would eventually discover this.
1 parent caac176 commit 28623dc

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

toxav/rtp.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,9 @@ void rtp_kill(RTPSession *session)
710710
LOGGER_DEBUG(session->m->log, "Terminated RTP session V3 work_buffer_list->next_free_entry: %d",
711711
(int)session->work_buffer_list->next_free_entry);
712712

713+
for (int8_t i = 0; i < session->work_buffer_list->next_free_entry; ++i) {
714+
free(session->work_buffer_list->work_buffer[i].buf);
715+
}
713716
free(session->work_buffer_list);
714717
free(session);
715718
}

0 commit comments

Comments
 (0)