]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_pjsip_outbound_registration: Fix double unref on error return. 06/306/1
authorJoshua Colp <jcolp@digium.com>
Thu, 30 Apr 2015 11:04:34 +0000 (08:04 -0300)
committerJoshua Colp <jcolp@digium.com>
Thu, 30 Apr 2015 11:27:21 +0000 (08:27 -0300)
commite332c7ed5ebb24e13981d7471f0dd54f3bdd83e6
tree37274471e0d72dc9f42334f270d4923807ba129e
parent37a193da1861193198692c8acc52ac43a5ae5bc1
res_pjsip_outbound_registration: Fix double unref on error return.

When the PJSIP pjsip_regc_send function is invoked and an error
status returned the caller currently decrements the reference count
of the client state that it just incremented, assuming the
registration callback would not have been invoked. In practice
this is not correct. If the failure happens after the transaction
has been set up the callback will still be invoked. This will
cause the reference count to be incorrectly decremented twice, once
by the registration callback and second by the caller of
pjsip_regc_send.

This change makes it so that whether the callback is invoked or
not is known by the caller of pjsip_regc_send. Depending on
this it can know whether it is responsible for decrementing the
reference count of the client state or not.

ASTERISK-25037 #close
Reported by: Joshua Colp

Change-Id: I749dc12f3a22115c49c5d7d95ff42a5fa45319de
res/res_pjsip_outbound_registration.c