Skip to content

Commit

Permalink
b2b_entities: fix shm memory leak
Browse files Browse the repository at this point in the history
For the write back db mode, the entity storage data was only freed after
inserting/updating the entity in the database. This would lead to memory
leaks if the entity was deleted before the DB timer task had a chance
to be run.

Thanks go to Norm Brandinger from Five9 for reporting!
  • Loading branch information
rvlad-patrascu committed Sep 20, 2022
1 parent 66898d8 commit aee014b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/b2b_entities/dlg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1306,6 +1306,8 @@ void destroy_b2b_htables(void)
aux = dlg->next;
if(dlg->tag[CALLEE_LEG].s)
shm_free(dlg->tag[CALLEE_LEG].s);
if (b2be_db_mode == WRITE_BACK && dlg->storage.s)
shm_free(dlg->storage.s);
if(dlg->ack_sdp.s)
shm_free(dlg->ack_sdp.s);
if (dlg->logic_key.s)
Expand Down Expand Up @@ -1805,6 +1807,9 @@ void b2b_delete_record(b2b_dlg_t* dlg, b2b_table htable, unsigned int hash_index

b2b_delete_legs(&dlg->legs);

if (b2be_db_mode == WRITE_BACK && dlg->storage.s)
shm_free(dlg->storage.s);

if(dlg->uac_tran)
tmb.unref_cell(dlg->uac_tran);

Expand Down

0 comments on commit aee014b

Please sign in to comment.