res_pjsip_pubsub: Fix reference to released endpoint
authorGeorge Joseph <gjoseph@digium.com>
Wed, 14 Jun 2017 16:12:21 +0000 (10:12 -0600)
committerGeorge Joseph <gjoseph@digium.com>
Wed, 14 Jun 2017 16:16:54 +0000 (11:16 -0500)
commit65ed2ea311146264c4ae0c5edd6c5932e6b06f32
treef5947fc34fc43c09d036234cc0b128992791e7e5
parentc33168c14761a38ec8732dbcb6d3be2758a6571a
res_pjsip_pubsub:  Fix reference to released endpoint

destroy_subscription was attempting to get the id of the
subscription tree's endpoint after we'd already called ao2_cleanup
on it causing a segfault.

Moved the cleanup until after the debug statement and since
endpoint could also be NULL at this point, check for that as well.

ASTERISK-27057 #close
Reported-by: Ryan Smith

Change-Id: Ice0a7727f560cf204d870a774c6df71e159b1678
res/res_pjsip_pubsub.c