Skip to content

Commit

Permalink
b2b_entities: fix b2b key memory leak
Browse files Browse the repository at this point in the history
(cherry picked from commit 8ba6567)
  • Loading branch information
razvancrainea committed Jul 24, 2017
1 parent 538bb63 commit 57f0193
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions modules/b2b_entities/dlg.c
Expand Up @@ -1531,19 +1531,22 @@ void free_tm_dlg(dlg_t* td)
int b2b_send_indlg_req(b2b_dlg_t* dlg, enum b2b_entity_type et,
str* b2b_key, str* method, str* ehdr, str* body, unsigned int no_cb)
{
str* b2b_key_shm;
str* b2b_key_shm = NULL;
dlg_t* td = NULL;
transaction_cb* tm_cback;
build_dlg_f build_dlg;
int method_value = dlg->last_method;
int result;

b2b_key_shm= b2b_key_copy_shm(b2b_key);
if(b2b_key_shm== NULL)
{
LM_ERR("no more shared memory\n");
return -1;
if (!no_cb) {
b2b_key_shm= b2b_key_copy_shm(b2b_key);
if(b2b_key_shm== NULL)
{
LM_ERR("no more shared memory\n");
return -1;
}
}

if(et == B2B_SERVER)
{
build_dlg = b2b_server_build_dlg;
Expand All @@ -1561,7 +1564,8 @@ int b2b_send_indlg_req(b2b_dlg_t* dlg, enum b2b_entity_type et,
{
LM_ERR("Failed to build tm dialog structure, was asked to send [%.*s]"
" request\n", method->len, method->s);
shm_free(b2b_key_shm);
if (b2b_key_shm)
shm_free(b2b_key_shm);
return -1;
}

Expand Down

0 comments on commit 57f0193

Please sign in to comment.