Skip to content

Commit

Permalink
siprec: Fix invalid READ operation on freed memory
Browse files Browse the repository at this point in the history
Also tidy up the cleanup phase

Thanks to Rob Moore, Daniel Bryars and Steven Ayre from Dubber for
reporting it and providing valuable information for troubleshooting!
  • Loading branch information
liviuchircu committed Aug 31, 2023
1 parent 7962c75 commit 9996f9f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions modules/siprec/siprec_logic.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,14 +646,19 @@ void srec_logic_destroy(struct src_sess *sess)
{
if (!sess->b2b_key.s)
return;
shm_free(sess->b2b_key.s);

if (sess->initial_sdp.s)
if (sess->initial_sdp.s) {
shm_free(sess->initial_sdp.s);
sess->initial_sdp.s = NULL;
}

srec_b2b.entity_delete(B2B_CLIENT, &sess->b2b_key, sess->dlginfo, 1, 1);
if (sess->dlginfo)
if (sess->dlginfo) {
shm_free(sess->dlginfo);
sess->dlginfo = NULL;
}

shm_free(sess->b2b_key.s);
sess->b2b_key.s = NULL;

sess->flags &= ~SIPREC_STARTED;
Expand Down

0 comments on commit 9996f9f

Please sign in to comment.