]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Remove the provisional keepalive scheduler entry's reference to the pvt when we remov...
authorMatthew Nicholson <mnicholson@digium.com>
Thu, 17 Mar 2011 19:06:24 +0000 (19:06 +0000)
committerMatthew Nicholson <mnicholson@digium.com>
Thu, 17 Mar 2011 19:06:24 +0000 (19:06 +0000)
ABE-2756

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

channels/chan_sip.c

index f8fd4f4acc475e210d2696f96c744f567b3e5fff..4f6338c93bba6cde236cbb7f74a5e9252c032242 100644 (file)
@@ -2487,11 +2487,17 @@ static void remove_provisional_keepalive_sched(struct sip_pvt *pvt)
                return;
        }
        res = AST_SCHED_DEL(sched, pvt->provisional_keepalive_data->sched_id);
-       /* If we could not remove this item. remove pvt's reference this data and mark it for removal
-        * for the next time the scheduler uses it. The scheduler has it's own ref to this data
-        * and will detect it should not reschedule the event since the sched_id is -1 and pvt == NULL */
        if (res == -1) {
+               /* If we could not remove this item. remove pvt's reference
+                * this data and mark it for removal for the next time the
+                * scheduler uses it. The scheduler has it's own ref to this
+                * data and will detect it should not reschedule the event
+                * since the sched_id is -1 and pvt == NULL */
                pvt->provisional_keepalive_data = unref_provisional_keepalive(pvt->provisional_keepalive_data);
+       } else {
+               /* If we successfully canceled the scheduler entry, we need to
+                * remove its reference to the data. */
+               ao2_ref(pvt->provisional_keepalive_data, -1);
        }
 }