aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_festival.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/app_festival.c')
-rwxr-xr-xapps/app_festival.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/apps/app_festival.c b/apps/app_festival.c
index e7e0bd426..6ce8a4f83 100755
--- a/apps/app_festival.c
+++ b/apps/app_festival.c
@@ -131,7 +131,6 @@ static int send_waveform_to_fd(char *waveform, int length, int fd) {
#endif
write(fd,waveform,length);
- write(fd,"a",1);
close(fd);
exit(0);
}
@@ -305,9 +304,9 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
if (!(festivalcommand = ast_variable_retrieve(cfg, "general", "festivalcommand"))) {
festivalcommand = "(tts_textasterisk \"%s\" 'file)(quit)\n";
}
- ast_destroy(cfg);
if (!vdata || ast_strlen_zero(vdata)) {
ast_log(LOG_WARNING, "festival requires an argument (text)\n");
+ ast_destroy(cfg);
return -1;
}
strncpy(data, vdata, sizeof(data) - 1);
@@ -325,6 +324,7 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
if (fd < 0) {
ast_log(LOG_WARNING,"festival_client: can't get socket\n");
+ ast_destroy(cfg);
return -1;
}
memset(&serv_addr, 0, sizeof(serv_addr));
@@ -333,6 +333,7 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
serverhost = ast_gethostbyname(host, &ahp);
if (serverhost == (struct hostent *)0) {
ast_log(LOG_WARNING,"festival_client: gethostbyname failed\n");
+ ast_destroy(cfg);
return -1;
}
memmove(&serv_addr.sin_addr,serverhost->h_addr, serverhost->h_length);
@@ -342,6 +343,7 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
if (connect(fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) != 0) {
ast_log(LOG_WARNING,"festival_client: connect to server failed\n");
+ ast_destroy(cfg);
return -1;
}
@@ -444,6 +446,7 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
}
} while (strcmp(ack,"OK\n") != 0);
close(fd);
+ ast_destroy(cfg);
LOCAL_USER_REMOVE(u);
return res;