Minor tweak - we need to lock the channel when we are removing the spy from it.
[asterisk/asterisk.git] / apps / app_chanspy.c
index d0fdda2..01adbac 100644 (file)
@@ -370,7 +370,9 @@ static int channel_spy(struct ast_channel *chan, struct ast_channel *spyee, int
        /* If a channel still exists on our spy structure then we need to remove ourselves */
        if (csth.spy.chan) {
                csth.spy.status = CHANSPY_DONE;
+               ast_channel_lock(csth.spy.chan);
                ast_channel_spy_remove(csth.spy.chan, &csth.spy);
+               ast_channel_unlock(csth.spy.chan);
        }
        ast_channel_spy_free(&csth.spy);