]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_festival: Fix fd leak on connection failure.
authorCorey Farrell <git@cfware.com>
Wed, 20 Dec 2017 06:53:17 +0000 (01:53 -0500)
committerCorey Farrell <git@cfware.com>
Wed, 20 Dec 2017 16:59:50 +0000 (10:59 -0600)
Change-Id: If5efaddcf735ff7d17e55c36cc1388946cee9e0f

apps/app_festival.c

index 7df8caf8a851ae97905259776750b4e074c64f0b..117bc1aebed0a237da052c5ca1e7f6a1d46384e1 100644 (file)
@@ -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;
        }