[Asterisk-code-review] app festival: Fix fd leak on connection failure. (asterisk[master])

Corey Farrell asteriskteam at digium.com
Wed Dec 20 10:59:29 CST 2017


Corey Farrell has uploaded this change for review. ( https://gerrit.asterisk.org/7679


Change subject: app_festival: Fix fd leak on connection failure.
......................................................................

app_festival: Fix fd leak on connection failure.

Change-Id: If5efaddcf735ff7d17e55c36cc1388946cee9e0f
---
M apps/app_festival.c
1 file changed, 2 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/79/7679/1

diff --git a/apps/app_festival.c b/apps/app_festival.c
index 3e2e020..715437e 100644
--- a/apps/app_festival.c
+++ b/apps/app_festival.c
@@ -403,6 +403,7 @@
 		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);
@@ -414,6 +415,7 @@
 	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;
 	}
 

-- 
To view, visit https://gerrit.asterisk.org/7679
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: If5efaddcf735ff7d17e55c36cc1388946cee9e0f
Gerrit-Change-Number: 7679
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171220/23b39880/attachment-0001.html>


More information about the asterisk-code-review mailing list