]> git.pld-linux.org Git - packages/pjproject.git/blob - 0001-r5400-pjsip_tx_data_dec_ref.patch
Patches and config_site.h updates from Asterisk 13.12
[packages/pjproject.git] / 0001-r5400-pjsip_tx_data_dec_ref.patch
1 This patch fixes the issue in pjsip_tx_data_dec_ref()
2 when tx_data_destroy can be called more than once,
3 and checks if invalid value (e.g. NULL) is passed to.
4
5 Index: pjsip/src/pjsip/sip_transport.c
6 ===================================================================
7 --- a/pjsip/src/pjsip/sip_transport.c   (revision 5399)
8 +++ b/pjsip/src/pjsip/sip_transport.c   (revision 5400)
9 @@ -491,8 +491,13 @@
10   */
11  PJ_DEF(pj_status_t) pjsip_tx_data_dec_ref( pjsip_tx_data *tdata )
12  {
13 -    pj_assert( pj_atomic_get(tdata->ref_cnt) > 0);
14 -    if (pj_atomic_dec_and_get(tdata->ref_cnt) <= 0) {
15 +    pj_atomic_value_t ref_cnt;
16 +    
17 +    PJ_ASSERT_RETURN(tdata && tdata->ref_cnt, PJ_EINVAL);
18 +
19 +    ref_cnt = pj_atomic_dec_and_get(tdata->ref_cnt);
20 +    pj_assert( ref_cnt >= 0);
21 +    if (ref_cnt == 0) {
22         tx_data_destroy(tdata);
23         return PJSIP_EBUFDESTROYED;
24      } else {
This page took 0.058484 seconds and 3 git commands to generate.