Version 0.2.0 from FTP
[asterisk/asterisk.git] / sched.c
diff --git a/sched.c b/sched.c
index a4fb109..f3841e3 100755 (executable)
--- a/sched.c
+++ b/sched.c
@@ -23,6 +23,7 @@
 #include <unistd.h>
 #include <asterisk/sched.h>
 #include <asterisk/logger.h>
+#include <asterisk/channel.h>
 
 /* Determine if a is sooner than b */
 #define SOONER(a,b) (((b).tv_sec > (a).tv_sec) || \
@@ -237,14 +238,15 @@ int ast_sched_del(struct sched_context *con, int id)
                        else
                                con->schedq = s->next;
                        con->schedcnt--;
+                       sched_release(con, s);
                        return 0;
                }
                last = s;
                s = s->next;
        }
        ast_log(LOG_NOTICE, "Attempted to delete non-existant schedule entry %d!\n", id);
-#ifdef FORCE_CRASH
-       crash();
+#ifdef DO_CRASH
+       CRASH;
 #endif
        return -1;
 }