summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2016-07-28 03:17:04 +0000
committerNanang Izzuddin <nanang@teluu.com>2016-07-28 03:17:04 +0000
commitb70c0e8e535cbeab70eaf43feac3ed9c52ef10bc (patch)
tree6a67312951ac634b25f6f86787d2762842920ce6 /pjsip
parent53e80fb632fee4b377cd652aafdebe996279090e (diff)
Misc (re #1945): Updated checks in pjsip_tx_data_dec_ref(). Thanks Alexei Gradinari for the feedback and the patch.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5400 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/src/pjsip/sip_transport.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/pjsip/src/pjsip/sip_transport.c b/pjsip/src/pjsip/sip_transport.c
index fffc5cf3..d672a6de 100644
--- a/pjsip/src/pjsip/sip_transport.c
+++ b/pjsip/src/pjsip/sip_transport.c
@@ -491,8 +491,13 @@ static void tx_data_destroy(pjsip_tx_data *tdata)
*/
PJ_DEF(pj_status_t) pjsip_tx_data_dec_ref( pjsip_tx_data *tdata )
{
- pj_assert( pj_atomic_get(tdata->ref_cnt) > 0);
- if (pj_atomic_dec_and_get(tdata->ref_cnt) <= 0) {
+ pj_atomic_value_t ref_cnt;
+
+ PJ_ASSERT_RETURN(tdata && tdata->ref_cnt, PJ_EINVAL);
+
+ ref_cnt = pj_atomic_dec_and_get(tdata->ref_cnt);
+ pj_assert( ref_cnt >= 0);
+ if (ref_cnt == 0) {
tx_data_destroy(tdata);
return PJSIP_EBUFDESTROYED;
} else {