return;
AST_LIST_TRAVERSE(&chan->spies->list, spy, list) {
- if ((spy->type == type) && (spy->status == CHANSPY_RUNNING))
+ ast_mutex_lock(&spy->lock);
+ if ((spy->type == type) && (spy->status == CHANSPY_RUNNING)) {
spy->status = CHANSPY_DONE;
+ if (ast_test_flag(spy, CHANSPY_TRIGGER_MODE) != CHANSPY_TRIGGER_NONE)
+ ast_cond_signal(&spy->trigger);
+ }
+ ast_mutex_unlock(&spy->lock);
}
}
if (need_dup)
result = ast_frdup(read_frame);
- else
+ else {
result = read_frame;
+ ast_frfree(write_frame);
+ }
} else {
if (need_dup) {
result = ast_frdup(read_frame);