From a4c142d73d1008f0a5ba4fba1b94517d07d0b943 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Thu, 24 May 2007 22:23:59 +0000 Subject: [PATCH] if the string field init fails, clean up the stuff that was allocated already git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@66076 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/channel.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main/channel.c b/main/channel.c index f7def7e903..d830f1f8b3 100644 --- a/main/channel.c +++ b/main/channel.c @@ -742,8 +742,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,