From: Corey Farrell Date: Wed, 20 Dec 2017 06:53:17 +0000 (-0500) Subject: app_festival: Fix fd leak on connection failure. X-Git-Tag: 13.20.0-rc1~148^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b3188fb8cecf576268b7fcfacb86982398c19a9;p=thirdparty%2Fasterisk.git app_festival: Fix fd leak on connection failure. Change-Id: If5efaddcf735ff7d17e55c36cc1388946cee9e0f --- diff --git a/apps/app_festival.c b/apps/app_festival.c index 7df8caf8a8..117bc1aebe 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; }