summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins2 <jenkins2@gerrit.asterisk.org>2017-12-21 06:11:47 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-12-21 06:11:47 -0600
commit2ca8095691674051d40ae14e2513ce792ed43b6f (patch)
tree1fda61c327d343490f93031b51dbeb3966124510
parent0097ad91ef82e81d04185e18303aa4f282c96fcb (diff)
parent6b3188fb8cecf576268b7fcfacb86982398c19a9 (diff)
Merge "app_festival: Fix fd leak on connection failure." into 13
-rw-r--r--apps/app_festival.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/apps/app_festival.c b/apps/app_festival.c
index 7df8caf8a..117bc1aeb 100644
--- a/apps/app_festival.c
+++ b/apps/app_festival.c
@@ -405,6 +405,7 @@ static int festival_exec(struct ast_channel *chan, const char *vdata)
if (serverhost == NULL) {
ast_log(LOG_WARNING, "festival_client: gethostbyname failed\n");
ast_config_destroy(cfg);
+ close(fd);
return -1;
}
memmove(&serv_addr.sin_addr, serverhost->h_addr, serverhost->h_length);
@@ -416,6 +417,7 @@ static int festival_exec(struct ast_channel *chan, const char *vdata)
if (connect(fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) != 0) {
ast_log(LOG_WARNING, "festival_client: connect to server failed\n");
ast_config_destroy(cfg);
+ close(fd);
return -1;
}