summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/channel.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/main/channel.c b/main/channel.c
index 6522837ed..d75e98306 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -652,8 +652,11 @@ struct ast_channel *ast_channel_alloc(int needqueue, int state, const char *cid_
return NULL;
}
- if ((ast_string_field_init(tmp, 128)))
+ if ((ast_string_field_init(tmp, 128))) {
+ sched_context_destroy(tmp->sched);
+ free(tmp);
return NULL;
+ }
/* Don't bother initializing the last two FD here, because they
will *always* be set just a few lines down (AST_TIMING_FD,