festival: fix fd leak

Coverity 1139831
This commit is contained in:
Vincent Penquerc'h 2014-04-08 12:20:40 +01:00
parent 2b5d043654
commit ff11934bbf

View file

@ -358,6 +358,7 @@ festival_socket_open (const char *host, int port)
serverhost = gethostbyname (host);
if (serverhost == (struct hostent *) 0) {
fprintf (stderr, "festival_client: gethostbyname failed\n");
close (fd);
return -1;
}
memmove (&serv_addr.sin_addr, serverhost->h_addr, serverhost->h_length);
@ -367,6 +368,7 @@ festival_socket_open (const char *host, int port)
if (connect (fd, (struct sockaddr *) &serv_addr, sizeof (serv_addr)) != 0) {
fprintf (stderr, "festival_client: connect to server failed\n");
close (fd);
return -1;
}