summaryrefslogtreecommitdiff
path: root/channels/chan_local.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels/chan_local.c')
-rw-r--r--channels/chan_local.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/channels/chan_local.c b/channels/chan_local.c
index 5518a7155..7e7ef3c4e 100644
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -793,13 +793,12 @@ static struct ast_channel *local_new(struct local_pvt *p, int state)
ama = 0;
if (!(tmp = ast_channel_alloc(1, state, 0, 0, t, p->exten, p->context, ama, "Local/%s@%s-%04x;1", p->exten, p->context, randnum))
|| !(tmp2 = ast_channel_alloc(1, AST_STATE_RING, 0, 0, t, p->exten, p->context, ama, "Local/%s@%s-%04x;2", p->exten, p->context, randnum))) {
- if (tmp)
- ast_channel_free(tmp);
- if (tmp2)
- ast_channel_free(tmp2);
+ if (tmp) {
+ tmp = ast_channel_release(tmp);
+ }
ast_log(LOG_WARNING, "Unable to allocate channel structure(s)\n");
return NULL;
- }
+ }
tmp2->tech = tmp->tech = &local_tech;