aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>2015-09-11 15:05:48 -0700
committerReynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>2015-09-11 18:33:13 -0700
commit2580395e1cd27c643bd95712c88ba7c0358c44ac (patch)
tree6f6b5e1934238690733f841925aeca9db9ae4873
parent9a168e9371d6fbd69c9a88d5573a5ade095efaaf (diff)
downloadffmpeg-2580395e1cd27c643bd95712c88ba7c0358c44ac.tar.gz
ffserver: unify exit path in http_server()
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
-rw-r--r--ffserver.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/ffserver.c b/ffserver.c
index 2a5bc92d5d..d4b25f22f9 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -566,25 +566,21 @@ static int http_server(void)
if (config.http_addr.sin_port) {
server_fd = socket_open_listen(&config.http_addr);
- if (server_fd < 0) {
- av_free(poll_table);
- return -1;
- }
+ if (server_fd < 0)
+ goto quit;
}
if (config.rtsp_addr.sin_port) {
rtsp_server_fd = socket_open_listen(&config.rtsp_addr);
if (rtsp_server_fd < 0) {
- av_free(poll_table);
closesocket(server_fd);
- return -1;
+ goto quit;
}
}
if (!rtsp_server_fd && !server_fd) {
http_log("HTTP and RTSP disabled.\n");
- av_free(poll_table);
- return -1;
+ goto quit;
}
http_log("FFserver started.\n");
@@ -662,8 +658,7 @@ static int http_server(void)
ret = poll(poll_table, poll_entry - poll_table, delay);
if (ret < 0 && ff_neterrno() != AVERROR(EAGAIN) &&
ff_neterrno() != AVERROR(EINTR)) {
- av_free(poll_table);
- return -1;
+ goto quit;
}
} while (ret < 0);
@@ -697,6 +692,10 @@ static int http_server(void)
new_connection(rtsp_server_fd, 1);
}
}
+
+quit:
+ av_free(poll_table);
+ return -1;
}
/* start waiting for a new HTTP/RTSP request */