]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fixes some ref count issues introduced by r274539
authorDavid Vossel <dvossel@digium.com>
Wed, 7 Jul 2010 20:09:00 +0000 (20:09 +0000)
committerDavid Vossel <dvossel@digium.com>
Wed, 7 Jul 2010 20:09:00 +0000 (20:09 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@274686 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 4e040ae2e3387ef85e44fc6a1c096cc30cf2a68e..5d8b7b4e9895df5f9fcb3b9b642517faf2990d94 100644 (file)
@@ -5259,7 +5259,8 @@ static int update_call_counter(struct sip_pvt *fup, int event)
        ast_copy_string(name, fup->username, sizeof(name));
 
        /* Check the list of devices */
-       if ((p = fup->relatedpeer)) {
+       if (fup->relatedpeer) {
+               p = ref_peer(fup->relatedpeer, "ref related peer for update_call_counter");
                inuse = &p->inUse;
                call_limit = &p->call_limit;
                inringing = &p->inRinging;
@@ -20720,8 +20721,10 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int
                }
 
                /* Successful authentication and peer matching so record the peer related to this pvt (for easy access to peer settings) */
+               if (p->relatedpeer) {
+                       p->relatedpeer = unref_peer(p->relatedpeer,"unsetting the relatedpeer field in the dialog, before it is set to something else.");
+               }
                p->relatedpeer = ref_peer(authpeer, "setting dialog's relatedpeer pointer");
-
                /* If T38 is needed but not present, then make it magically appear */
                if (ast_test_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT) && !p->udptl) {
                        if ((p->udptl = ast_udptl_new_with_bindaddr(sched, io, 0, bindaddr.sin_addr))) {
@@ -21166,6 +21169,9 @@ request_invite_cleanup:
                        ast_channel_unlock(p->refer->refer_call->owner);
                }
        }
+       if (authpeer) {
+               authpeer = unref_peer(authpeer, "unref_peer, from handle_request_invite authpeer");
+       }
 
        return res;
 }