Skip to content

Commit

Permalink
tm: fix bavp leaks in case of error
Browse files Browse the repository at this point in the history
Thanks go to Mickael Marrache for spotting and debugging

(cherry picked from commit 70a34b9)
  • Loading branch information
razvancrainea committed Aug 19, 2015
1 parent 87a6660 commit 4dcacf7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions modules/tm/t_fwd.c
Expand Up @@ -422,6 +422,17 @@ static int add_uac( struct cell *t, struct sip_msg *request, str *uri,
}
error01:
post_print_uac_request( request, uri, next_hop);
if (ret < 0) {
/* destroy all the bavps added, the path vector and the destination,
* since this branch will never be properly added to
* the UAC list, otherwise we'll have memory leaks - razvanc */
if (t->uac[branch].user_avps)
destroy_avp_list(&t->uac[branch].user_avps);
if (t->uac[branch].path_vec.s)
shm_free(t->uac[branch].path_vec.s);
if (t->uac[branch].duri.s)
shm_free(t->uac[branch].duri.s);
}
error:
return ret;
}
Expand Down

0 comments on commit 4dcacf7

Please sign in to comment.