summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/app_chanspy.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c
index ab056e0aa..f37de3889 100644
--- a/apps/app_chanspy.c
+++ b/apps/app_chanspy.c
@@ -714,8 +714,10 @@ static int common_exec(struct ast_channel *chan, const struct ast_flags *flags,
res = ast_streamfile(chan, peer_name, chan->language);
if (!res)
res = ast_waitstream(chan, "");
- if (res)
+ if (res) {
+ chanspy_ds_free(peer_chanspy_ds);
break;
+ }
} else
res = ast_say_character_str(chan, peer_name, "", chan->language);
if ((num = atoi(ptr)))
@@ -731,6 +733,7 @@ static int common_exec(struct ast_channel *chan, const struct ast_flags *flags,
goto exit;
} else if (res == -2) {
res = 0;
+ chanspy_ds_free(peer_chanspy_ds);
goto exit;
} else if (res > 1 && spec) {
struct ast_channel *next;