From 215638e661f0b0136a8c16d730ace81ab7b7618b Mon Sep 17 00:00:00 2001 From: David Vossel Date: Mon, 16 May 2011 15:57:26 +0000 Subject: [PATCH] Merged revisions 319144 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ........ r319144 | dvossel | 2011-05-16 10:56:16 -0500 (Mon, 16 May 2011) | 2 lines Fixes issue with peer ref-counting during handle_request_subscribe. (closes issue #19293) Reported by: irroot ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@319145 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 63d4a6964f..f58006283d 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -23707,7 +23707,7 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req, const char *unknown_acceptheader = NULL; if (authpeer) /* We do not need the authpeer any more */ - unref_peer(authpeer, "unref_peer, from handle_request_subscribe (authpeer 2)"); + authpeer = unref_peer(authpeer, "unref_peer, from handle_request_subscribe (authpeer 2)"); /* Header from Xten Eye-beam Accept: multipart/related, application/rlmi+xml, application/pidf+xml, application/xpidf+xml */ accept = __get_header(req, "Accept", &start); @@ -23838,9 +23838,10 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req, return 0; } - /* At this point, if we have an authpeer (which we have to have to get here) we should unref - * it since if we have actually used it, we have reffed it when p->relatedpeer was set. */ - authpeer = unref_peer(authpeer, "unref pointer into (*authpeer)"); + /* At this point, if we have an authpeer we should unref it. */ + if (authpeer) { + authpeer = unref_peer(authpeer, "unref pointer into (*authpeer)"); + } /* Add subscription for extension state from the PBX core */ if (p->subscribed != MWI_NOTIFICATION && p->subscribed != CALL_COMPLETION && !resubscribe) { -- 2.47.2