ffserver: unify fail path in socket_open_listen()

Signed-off-by: 's avatarReynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
parent 4b66274a
...@@ -470,20 +470,22 @@ static int socket_open_listen(struct sockaddr_in *my_addr) ...@@ -470,20 +470,22 @@ static int socket_open_listen(struct sockaddr_in *my_addr)
snprintf(bindmsg, sizeof(bindmsg), "bind(port %d)", snprintf(bindmsg, sizeof(bindmsg), "bind(port %d)",
ntohs(my_addr->sin_port)); ntohs(my_addr->sin_port));
perror (bindmsg); perror (bindmsg);
closesocket(server_fd); goto fail;
return -1;
} }
if (listen (server_fd, 5) < 0) { if (listen (server_fd, 5) < 0) {
perror ("listen"); perror ("listen");
closesocket(server_fd); goto fail;
return -1;
} }
if (ff_socket_nonblock(server_fd, 1) < 0) if (ff_socket_nonblock(server_fd, 1) < 0)
av_log(NULL, AV_LOG_WARNING, "ff_socket_nonblock failed\n"); av_log(NULL, AV_LOG_WARNING, "ff_socket_nonblock failed\n");
return server_fd; return server_fd;
fail:
closesocket(server_fd);
return -1;
} }
/* start all multicast streams */ /* start all multicast streams */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment