diff --git a/main/channel.c b/main/channel.c
index 13968e4837fc57e9cad5f1c416c5dc1222c94696..0dd937c1e23bea664cc839194e24ab468b300bb4 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -673,6 +673,7 @@ struct ast_channel *ast_channel_alloc(int needqueue, int state, const char *cid_
 	if (needqueue) {
 		if (pipe(tmp->alertpipe)) {
 			ast_log(LOG_WARNING, "Channel allocation failed: Can't create alert pipe!\n");
+			sched_context_destroy(tmp->sched);
 			ast_string_field_free_memory(tmp);
 			ast_free(tmp);
 			return NULL;