]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_pjsip_outbound_registration: Fix double unref on error return. 08/308/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 13:57:59 +0000 (10:57 -0300)
commit47df4e031cce11f7fe49e894d69a5045441b9ffe
treeb0221bd01d6f14c8e8846455fb1bae9677c7ac17
parent11d85ea2511fcfdc444ea627d7f636ce8912510b
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