summaryrefslogtreecommitdiff
path: root/main/channel.c
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2006-09-03 16:41:02 +0000
committerRussell Bryant <russell@russellbryant.com>2006-09-03 16:41:02 +0000
commite576ac09309fd2148da271f570a965e57d6d2308 (patch)
tree139f0e9d293e511317274add7273b458aad945dd /main/channel.c
parentc4dac0c1e59236f9197c7c17c1fdbfff8e1276d6 (diff)
Don't use ast_frdup() in the AST_LIST_INSERT_TAIL macro directly. That was a
very stupid thing to do. It ends up duplicating the frame twice, linking in one of them and setting the tail pointer to the other one. Sorry ... Thanks to file for pointing out the breakage!!! file rocks. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@41864 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/channel.c')
-rw-r--r--main/channel.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/main/channel.c b/main/channel.c
index 5a4080c5c..248cf15ad 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -1334,6 +1334,7 @@ static void queue_frame_to_spies(struct ast_channel *chan, struct ast_frame *f,
AST_LIST_TRAVERSE(&chan->spies->list, spy, list) {
struct ast_channel_spy_queue *queue;
+ struct ast_frame *duped_fr;
ast_mutex_lock(&spy->lock);
@@ -1364,7 +1365,7 @@ static void queue_frame_to_spies(struct ast_channel *chan, struct ast_frame *f,
break;
}
}
- AST_LIST_INSERT_TAIL(&queue->list, ast_frdup(translated_frame), frame_list);
+ duped_fr = ast_frdup(translated_frame);
} else {
if (f->subclass != queue->format) {
ast_log(LOG_WARNING, "Spy '%s' on channel '%s' wants format '%s', but frame is '%s', dropping\n",
@@ -1373,9 +1374,11 @@ static void queue_frame_to_spies(struct ast_channel *chan, struct ast_frame *f,
ast_mutex_unlock(&spy->lock);
continue;
}
- AST_LIST_INSERT_TAIL(&queue->list, ast_frdup(f), frame_list);
+ duped_fr = ast_frdup(f);
}
+ AST_LIST_INSERT_TAIL(&queue->list, duped_fr, frame_list);
+
queue->samples += f->samples;
if (queue->samples > SPY_QUEUE_SAMPLE_LIMIT) {