]> 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:43 +0000 (10:59 -0600)
Change-Id: If5efaddcf735ff7d17e55c36cc1388946cee9e0f

apps/app_festival.c

index 3e2e020b8340288fcf1c5086b9a217c767162a7d..715437e7e3564e53766293d412ec10d9ff9264e7 100644 (file)
@@ -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;
        }