summaryrefslogtreecommitdiff
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 158dc7b18..6cfb59879 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -1709,6 +1709,7 @@ static int publish_expire(const void *data)
ast_assert(esc != NULL);
ao2_unlink(esc->compositor, esc_entry);
+ esc_entry->sched_id = -1;
ao2_ref(esc_entry, -1);
return 0;
}
@@ -1741,6 +1742,11 @@ static struct sip_esc_entry *create_esc_entry(struct event_state_compositor *esc
/* Bump refcount for scheduler */
ao2_ref(esc_entry, +1);
esc_entry->sched_id = ast_sched_add(sched, expires_ms, publish_expire, esc_entry);
+ if (esc_entry->sched_id == -1) {
+ ao2_ref(esc_entry, -1);
+ ao2_ref(esc_entry, -1);
+ return NULL;
+ }
/* Note: This links the esc_entry into the ESC properly */
create_new_sip_etag(esc_entry, 0);