mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
app_festival: Fix fd leak on connection failure.
Change-Id: If5efaddcf735ff7d17e55c36cc1388946cee9e0f
This commit is contained in:
@@ -403,6 +403,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);
|
||||
@@ -414,6 +415,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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user