]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fixes issue with peer ref-counting during handle_request_subscribe.
authorDavid Vossel <dvossel@digium.com>
Mon, 16 May 2011 15:56:16 +0000 (15:56 +0000)
committerDavid Vossel <dvossel@digium.com>
Mon, 16 May 2011 15:56:16 +0000 (15:56 +0000)
(closes issue #19293)
Reported by: irroot

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.2@319144 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index f2cfcf04d6f4ff04f434fcd5ce61e23420843559..14b4940cb85050f3f4cde78ed4a082c117bbfdf3 100644 (file)
@@ -22037,7 +22037,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 */
 
@@ -22168,9 +22168,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 && !resubscribe) {