[FFmpeg-cvslog] ffserver: unify fail path in socket_open_listen()

Reynaldo H. Verdejo Pinochet git at videolan.org
Sat Sep 12 03:44:32 CEST 2015


ffmpeg | branch: master | Reynaldo H. Verdejo Pinochet <reynaldo at osg.samsung.com> | Fri Sep 11 14:53:09 2015 -0700| [9a168e9371d6fbd69c9a88d5573a5ade095efaaf] | committer: Reynaldo H. Verdejo Pinochet

ffserver: unify fail path in socket_open_listen()

Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo at osg.samsung.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9a168e9371d6fbd69c9a88d5573a5ade095efaaf
---

 ffserver.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/ffserver.c b/ffserver.c
index 8b6e441..2a5bc92 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -470,20 +470,22 @@ static int socket_open_listen(struct sockaddr_in *my_addr)
         snprintf(bindmsg, sizeof(bindmsg), "bind(port %d)",
                  ntohs(my_addr->sin_port));
         perror (bindmsg);
-        closesocket(server_fd);
-        return -1;
+        goto fail;
     }
 
     if (listen (server_fd, 5) < 0) {
         perror ("listen");
-        closesocket(server_fd);
-        return -1;
+        goto fail;
     }
 
     if (ff_socket_nonblock(server_fd, 1) < 0)
         av_log(NULL, AV_LOG_WARNING, "ff_socket_nonblock failed\n");
 
     return server_fd;
+
+fail:
+    closesocket(server_fd);
+    return -1;
 }
 
 /* start all multicast streams */



More information about the ffmpeg-cvslog mailing list